RESTful APIs

The OM SDK provides standard RESTful APIs for developers to view or invoke. Developers can perform secondary development or integration of basic hardware management functions.

Redfish is a management standard based on HTTPS and uses RESTful APIs for device management. Each HTTPS method submits or returns a resource in JSON format encoded in UTF-8. Similar to web applications that return HTML to browsers, RESTful APIs use the same transmission mechanism (HTTPS) to return data in .json format to clients.

Resource Operations

Table 1 Redfish API operations

Operation

Description

GET resource URI

Returns the requested resource description.

POST resource URI

Creates a resource or executes a specified resource.

PATCH resource URI

Modifies current resource properties.

DELETE resource URI

Deletes a specified resource.

Returned Status Code

Table 2 Status code description

Status Code

Description

200

The request is successfully processed.

201

The resource is created successfully.

202

The task is successfully created.

206

Partially succeeded.

400

The request is invalid. An error occurs on the client and an error message is returned.

401

Invalid user request.

403

The server rejects the request.

404

The requested resource does not exist.

405

The operation is not supported.

409

The status of the requested resource conflicts with that of other resources.

413

The request entity is too large.

500

An internal server error occurs.

501

The requested operation is currently unavailable.

502

Gateway error.

503

The service is unavailable.

504

Gateway timed out.

URL Parameters

When invoking an interface, enter its URL. The following parameter must be added to each URL. For details about other URL parameters, see the URL parameter description of each interface.

Table 3 URL parameters

Parameter

Mandatory/Optional

Parameter Description

Value

device_ip

Mandatory

IP address for logging in to a device

An IPv4 or IPv6 address

Request Header Parameters

The following table describes the request header parameters involved in this document.

Table 4 Request headers

Parameter

Mandatory/Optional

Parameter Description

Value

X-Auth-Token

Mandatory

Authentication parameter contained in the request

You can obtain the value from the session created by using /redfish/v1/SessionService/Sessions.

Content-Type

Mandatory

Request format

Supported formats include:

  • application/json
  • application/json;charset=utf-8
  • multipart/form-data: Select this format for some interfaces that upload files in form.

AutoRefresh

Optional

Updates the start time of the session timeout.

The value can be true or false. If the value is true, the session timeout start time is not updated. If the value is false, the session timeout start time is updated to the current system timestamp.

NOTE:

If this parameter is not added, the default value true is used.

According to the HTTPS protocol, request header field names are case insensitive. For example, AutoRefresh and autorefresh have the same effect. All HTTPS request header fields involved in this document meet this requirement.