This topic describes the syntax of IoT Platform API requests and provides a sample request.

Request syntax

You can send HTTP or HTTPS requests to IoT Platform.

Request syntax:

http://Endpoint/?Action=xx&Parameters
Parameter Description
Endpoint The endpoint of IoT Platform. Format: iot.${RegionId}.aliyuncs.com. Replace ${RegionId} with the ID of the region where you activated IoT Platform. For more information about region IDs, see Supported regions.
Action The operation that you want to perform. For example, to publish a message to a specified topic, specify Action=Pub.
Parameters The request parameters of the operation. Separate multiple parameters with ampersands (&).

Request parameters include common parameters and operation-specific parameters. Common parameters specify the API version number and the authentication information.

The following code provides an example on how to call the Pub operation to publish a message to a topic:
Note In this example, IoT Platform is deployed in the China (Shanghai) region. The code is formatted for ease of reading. For more information about request parameters, see Common parameters and Pub.
https://iot.cn-shanghai.aliyuncs.com/?Action=Pub
&Format=XML
&Version=2018-01-20
&Signature=Pc5WB8gok***1dgI%3D
&SignatureMethod=HMAC-SHA1
&SignatureNonce=15215528852396
&SignatureVersion=1.0
&AccessKeyId=LTAI4***iW5j3
&Timestamp=2017-07-19T12:00:00Z
&RegionId=cn-shanghai
...
https://POP gateway domain name/data/api.json/?Action=Pub
&Format=XML
&Version=2017-04-20
&Signature=Pc5WB8gok***1dgI%3D
&SignatureMethod=HMAC-SHA1
&SignatureNonce=15215528852396
&SignatureVersion=1.0
&Timestamp=2017-07-19T12:00:00Z
...

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. You can use OpenAPI Explorer to search for API operations, call API operations, and dynamically generate SDK sample code. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs. On the right side of the page, you can view the sample code of an SDK on the Example Code tab. On the Debugging Result tab, you can view the actual request URL and response in the JSON format.

API authorization

To ensure the security of your account, we recommend that you call API operations as a RAM user. Before you call an API operation as a RAM user, you must create and attach the required RAM policy to the RAM user.

For more information, see Mapping of IoT Platform operations and RAM policies.