2 return codes, 3 uri format, 4 resource model format – HP OneView User Manual
Page 72: 5 log in to the appliance using rest apis, 6 rest api version
5.2 Return codes
Description
Return code
Successful operation
2xx
Client-side error with error message returned
4xx
Appliance error with error message returned
5xx
NOTE:
If an error occurs, indicated by a return code 4xx or 5xx, an ErrorMessage is returned.
The expected resource model is not returned.
5.3 URI format
All URIs point to resources. The client does not need to create or modify URIs. The URI for a resource
is static and uses the format https://{appl}/rest/resource category/resource ID
where:
https://{appl}
Appliance address
/rest
Type of URI
/resource category
Category of the resource (for example server-profiles)
/resource instance ID
Identifier of specific resource instance (optional)
5.4 Resource model format
The resources support JSON (JavaScript Object Notation) for exchanging data using a REST API.
If not otherwise specified in the REST API operation, the default is JSON.
5.5 Log in to the appliance using REST APIs
When you log in to the appliance using the login-sessions REST API, a session ID is returned.
You use the session ID in all subsequent REST API operations in the auth header, except as noted
in REST API Request Headers. The session ID is valid for 24 hours.
Log out
Log in
Operation
DELETE
API
/rest/login-sessions
Request headers
auth:{YourSessionID}
REST API Request Headers
Request body
None
Response
204 No Content
Operation
POST
API
/rest/login-sessions
Request headers
REST API Request Headers
Request body
{"userName":"YourUserName","password":"YourPassword"}
NOTE:
This is an example of a local log in on the appliance.
If you are using a directory service, you must add the following
attributes: authnHost and authLoginDomain.
Response
The LoginSessionIdDTO that includes the session ID
5.6 REST API version
When you perform a REST API operation, a X-API-Version header is required. This version
header corresponds to the REST API version of software currently running on the appliance. To
72
Using the REST APIs and other programmatic interfaces