HP OneView Deployment and Management Guide 1.05

Technical white paper | HP OneView Deployment and Management Guide
105
Section M21: REST API
REST (Representational State Transfer) is a web service format that uses basic Create, Read, Update and Delete (CRUD)
operations that are performed on resources using HTTP POST, GET, PUT and DELETE. To learn more about general REST
concepts, see:
http://en.wikipedia.org/wiki/Representational_state_transfer
HP OneView has a resource-oriented architecture that provides a uniform REST interface. Every resource has one Uniform
Resource Identifier (URI) and represents a physical device or logical construct, and may be manipulated using REST APIs. To
view the list of resources, see HP Converged Infrastructure Controller REST API Reference located in the Online Help of the
appliance [https://{ip}/help/cic/en/content/images/api/].
Resource operations
Basic Create, Read, Update and Delete (CRUD) operations are performed on the appliance resources via the standard HTTP
POST, GET, PUT and DELETE methods. RESTful interfaces are based on the World Wide Web standards, thus most modern
web servers can support these operations without modification.
Restful APIs are stateless. The resource state is maintained by the resource manager and is reported as the resource
representation. Any application state must be maintained by the client and it may manipulate the resource locally, but until
a PUT or POST is made, the resource as known by the resource manager is not changed.
Table 10. REST HTTP Operations
Operation
HTTP Verb
Description
Create
POST URI <Payload = Resource data>
New resources are created using the POST operation and
including relevant data in the payload. On Success the
Resource URI is returned.
Read
GET URI
Returns the requested resource representation(s)
Update
PUT URI <Payload = Update data>
Update an existing resource using the update data.
Delete
DELETE URI
Delete the addressed resource
URI format
All the appliance URIs point to resources and the client does not need to modify or create URIs. The URI for specific resource
is static and follows this format: https://{appl}/rest/{resource name}. The three parts are described below.
Table 11. URI Format
The appliance address.
Type of URI.
Name of the appliance resource such as server-
profile.
Data transfer format
The appliance resources support JSON (JavaScript Object Notation) as the standard for exchanging data using a REST API. If
JSON is not specified in the REST API call, then the default is JSON.
To learn more about JSON, go to www.json.org.
Accessing the ReST API with PowerShell
The HP OneView PowerShell Library is available for download at https://hponeview.codeplex.com, both the source code and
a pre-built installer. The library requires the Windows Management Framework 3.0 (aka PowerShell 3.0) to be installed, and
the .Net 4.0 Client Framework. The HP OneView POSH Library Installer will assist you with the installation of these two
required components if not found on the system.