This topic describes the common request parameters and common response parameters of the IoT Platform APIs.
Common request parameters
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 Valid values:
|
AccessKeyId | String | Yes | The AccessKey ID provided by Alibaba Cloud. To create or view an AccessKey pair, perform the following steps: Log on to the Alibaba Cloud Management Console, move the pointer over the profile picture, and then click AccessKey Management. On the AccessKey Pair page, view or create an AccessKey pair. |
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: For example, you can set this parameter to |
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. |
RegionId | String | Yes | The ID of the region where your devices reside. The region must be the same as the region that you specified in the IoT Platform console. Example: cn-shanghai. For more information about the IDs of the regions supported by IoT Platform, see Supported regions. |
Example:
https://iot.cn-shanghai.aliyuncs.com/
?Format=XML
&Version=2018-01-20
&Signature=Pc5WB***
&SignatureMethod=HMAC-SHA1
&SignatureNonce=15215528852396
&SignatureVersion=1.0
&AccessKeyId=234***
&Timestamp=2018-05-20T12:00:00Z
&RegionId=cn-shanghai
Common response parameters
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. If you cannot confirm what error occurs, contact Alibaba Cloud customer service or submit a ticket. You must provide your request ID for assistance.
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." }