5.2 Return codes

Return code

Description

2xx

Successful operation

4xx

Client-side error with error message returned

5xx

Appliance error with error message returned

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-sessionsREST 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 in

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

Log out

Operation

DELETE

API

/rest/login-sessions

Request headers

auth:{YourSessionID}

REST API Request Headers

Request body

None

Response

204 No Content

5.6 REST API version

When you perform a REST API operation, a X-API-Versionheader 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

Page 72
Image 72
HP OneView Return codes, URI format, Resource model format, Log in to the appliance using Rest APIs, Rest API version