Common parameters
This topic describes the common request and response parameters for the IoT Platform cloud APIs.
Common request parameters
Common request parameters are required for all API calls.
Name | Type | Required | Description |
Format | String | No | The format of the return value. Valid values: JSON and XML. The default value is XML. |
Version | String | Yes | The version number of the API. The version number is in the Version number (optional):
|
AccessKeyId | String | Yes | The AccessKey ID that Alibaba Cloud issues to you for service access. Log on to the Alibaba Cloud Management Console. Move the mouse pointer over your profile picture and click AccessKey Management. On the AccessKey page, create and view your AccessKey. |
Signature | String | Yes | The signature string. For more information, see Signature mechanism. |
SignatureMethod | String | Yes | The signature method. Only HMAC-SHA1 is supported. |
Timestamp | String | Yes | The timestamp of the request. The timestamp must be in the ISO 8601 standard and in UTC. The format is For example, |
SignatureVersion | String | Yes | The version of the signature algorithm. The current version is 1.0. |
SignatureNonce | String | Yes | A unique random number. It is used to prevent replay attacks. Use a different random number for each request. |
RegionId | String | Yes | The ID of the region where the device resides. This ID corresponds to the region in the console. Example: cn-shanghai. For information about the region IDs that IoT Platform supports, 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-shanghaiCommon response parameters
API responses use a unified format. A 2xx HTTP status code indicates that the call was successful, and a 4xx or 5xx HTTP status code indicates that the call failed. For successful calls, response data is returned in XML or JSON format. You can specify the data format in your request. The default format is XML.
For each API call, successful or not, the system returns a unique RequestId.
Example of a successful response
XML format
API version 2022-01-01
<!--The request tag--> <RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId> <!--The response data-->API version 2018-01-20
<?xml version="1.0" encoding="UTF-8"?> <!--The root node of the result--> <APIName+Response> <!--The request tag--> <RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId> <!--The response data--> </APIName+Response>
JSON format
{ "RequestId": "4C467B38-3910-447D-87BC-AC049166F216", "******":"${Response data}" }
Example of a failed response
If an API call fails, no result data is returned. You can use the error code to identify the cause of the error.
When a call fails, the HTTP request returns a 4xx or 5xx HTTP status code. The response body contains the specific error code, error message, and a globally unique request ID (RequestId).
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." }