This topic describes the common request parameters and common response parameters of the IoT Platform APIs.
Common request parameters must be included in all IoT Platform API requests.
| Parameter | Type | Required | Description |
|---|---|---|---|
| Format | String | No | The format in which you want to return the response. Valid values: JSON and XML. Default value: XML. |
| Version | String | Yes | The version number of the API. The value is in the YYYY-MM-DD format.Valid values:
|
| AccessKeyId | String | Yes | To create or view an AccessKey pair, refter to the Get Parameters |
| Signature | String | Yes | The signature string of the current request. For more information about how signatures are calculated, see Signature method. |
| SignatureMethod | String | Yes | The encryption method of the signature string. Set the value to HMAC-SHA1. |
| Timestamp | String | Yes | The timestamp of the request. Specify the time in the ISO 8601 standard. The time must be in UTC. Format: YYYY-MM-DDThh:mm:ssZ.For example, you can set this parameter to 2016-01-04T12:00:00Z, which indicates January 4, 2016 20:00:00 UTC+8. |
| SignatureVersion | String | Yes | The version number of the signature encryption algorithm. Set the value to 1.0. |
| SignatureNonce | String | Yes | A unique, random number used to prevent replay attacks. You must use different numbers for different requests. |
Example:
https://endpoint/
?Format=XML
&Version=2018-01-20
&Signature=Pc5WB***
&SignatureMethod=HMAC-SHA1
&SignatureNonce=15215528852396
&SignatureVersion=1.0
&AccessKeyId=234***
&Timestamp=2018-05-20T12:00:00Z
API responses use the HTTP response format where a 2xx status code indicates a successful call and a 4xx or 5xx status code indicates a failed call. Responses can be returned in either the JSON or XML format. You can specify the response format in the request. The default response format is XML.
Each response includes a unique request ID that is indicated by the RequestId parameter regardless of whether the call is successful.
Sample success responses
XML format
IoT Platform API of version 2022-01-01
<!--Return request tag-->
<RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId>
<!--Returned data-->
IoT Platform API of version 2018-01-20
<?xml version="1.0" encoding="UTF-8"?>
<!--Result root node-->
<Operation name + Response>
<!--Return request tag-->
<RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId>
<!--Return result data-->
</API operation name+Response>
JSON format
{
"RequestId": "4C467B38-3910-447D-87BC-AC049166F216"
/* Returned data */
}
Sample error responses
If an error occurs when you call an API operation, no result data is returned. You can use the error code to identify the cause of the error.
If an error occurs when you call an API operation, a 4XX or 5XX HTTP status code is returned. The returned message contains the specific error code and error message. The returned message also contains a globally unique request ID that is returned in the RequestId parameter.
XML format
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<RequestId>8906582E-6722-409A-A6C4-0E7863B733A5</RequestId>
<Code>UnsupportedOperation</Code>
<Message>The specified action is not supported.</Message>
</Error>
JSON format
{
"RequestId": "8906582E-6722-409A-A6C4-0E7863B733A5",
"Code": "UnsupportedOperation",
"Message": "The specified action is not supported."
}