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

Advertising
background image

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}

The appliance address

/rest

The type of URI

/resource category

The category of the resource (for example,
server-profiles

)

/resource instance ID

The specific resource instance identifier (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

72

Using the REST APIs and other programmatic interfaces

Advertising