beautypg.com

1 resource operations, 2 return codes, 3 uri format – HP OneView User Manual

Page 77

background image

5 Using the REST APIs and other programmatic interfaces

REST (Representational State Transfer) is a web service that uses basic CRUD (Create, Read, Update
and Delete) operations performed on resources using HTTP POST, GET, PUT, and DELETE. To
learn more about REST concepts, see

http://en.wikipedia.org/wiki/Representational_state_transfer

.

The appliance has a resource-oriented architecture that provides a uniform REST interface. Every
resource has one URI (Uniform Resource Identifier) and represents a physical device or logical
construct. You can use REST APIs to manipulate resources.

5.1 Resource operations

RESTful APIs are stateless. The resource manager maintains the resource state that is reported as
the resource representation. The client maintains the application state and the client might manipulate
the resource locally, but until a PUT or POST is made, the resource as known by the resource
manager is not changed.

Description

HTTP Verb

Operation

Creates new resources. A synchronous POST returns the newly created
resource. An asynchronous POST returns a TaskResource URI in the
Location

header. This URI tracks the progress of the POST operation.

POST

resource URI (payload =

resource data)

Create

Returns the requested resource representation(s)

GET

resource URI

Read

Updates an existing resource

PUT

resource URI (payload =

update data)

Update

Deletes the specified resource

DELETE

resource URI

Delete

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.1 Resource operations

77