Http methods, Content types and character encoding, Status codes – HP Intelligent Management Center Licenses User Manual

Page 30

Advertising
background image

HTTP methods

The iMC-RS interfaces use GET, POST, PUT, and DELETE to query (or read), add, modify (or
configure), and delete iMC resources. These HTTP methods comply with the recommendations in
RESTful web services.

In addition, you can query the methods supported by each URI with the OPTIONS method.

The HEAD method is also supported, which is identical to GET except that the server returns the
status code and message header only, but does not return a message body in the response.

Content types and character encoding

By default, the iMC-RS framework supports XML (application/xml) and JSON (application/json)
content types unless otherwise specified. You can specify these content types (accept/contentType)
in the HTTP request/response messages on the client.

Other content types are supported by certain interfaces. For more information, see the API
documents.

All message bodies in the packets exchanged by iMC-RS are encoded in UTF-8.

Status codes

The HTTP status codes returned by iMC-RS interfaces comply with the recommendations in RESTful
web services.

Multi-criteria batch query (GET method): 200 (OK) for success.

Single object query (GET method): 200 (OK) for success, 204 (No Content) for failure caused
by non-existent object.

Add (POST method): 201 (Created) for success and returning link to the object, 204 (No
Content) for success without returning any content.

Modify (PUT method): 204 (No Content) for success without returning any content, 404 (Not
Found) for failure caused by non-existent object.

Delete (DELETE method): 204 (No Content) for success without returning any content, 410
(Gone) for failure caused by non-existent object.

When performing operations, you may encounter errors due to service restrictions. For example,
if you try to delete an online operator, the server will return the status code 409 (Conflict), the
Error-Code attribute, and the Error-Message attribute. For more information about the error codes
and their descriptions, see

Error Codes

.”

In addition, you may encounter errors that are caused by error encoding or iMC server errors. The
following describes these errors, their status codes, and solutions:

Non-existent service specified by the URI: 404 (Not Found). Check the URI against the API
documentation and correct the URI. Note that when this error occurs, the returned packet
contains the message body in HTML format. When the object of the GET or PUT method does
not exist, the returned packet does not contain any message body, though its status code is
404 (Not Found).

Unsupported method: 405 (Method Not Allowed). Check the API documentation or use the
OPTIONS method to get the supported methods.

Unsupported content type: 406 (Not Acceptable). Set a valid content type (accept message
header) according to the API documentation.

Illegitimate parameters carried in the requested URI (such as the type cannot be changed):
400 (Bad Request). Check the API documentation for parameter restrictions.

Unauthorized request: 401 (Unauthorized). Set valid authentication parameters according to
the Identity Authentication and Privilege Control section and test code example.

30

R&D References

Advertising