Adds a topic to a data source in the rules engine.
Usage notes
Before you call the CreateDataSourceItem operation, you must create a data source. For more information, see "Step 1 to Step 6" in the Create a data source topic. Then, perform the following steps to view the ID of the data source: Log on to the IoT Platform console and click the name of the instance to which the data source belongs. Choose Rules Engine > Data Forwarding. On the Data Source tab, view the ID of the data source.
QPS limits
Each Alibaba Cloud account can run up to 10 queries per second (QPS).
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | CreateDataSourceItem |
The operation that you want to perform. Set the value to CreateDataSourceItem. |
DataSourceId | Long | Yes | 1002 |
The ID of the data source. |
Topic | String | Yes | /as/mqtt/status/gy***z/+ |
The topic that you want to add to the data source in the rules engine. Format:
For more information about how to use wildcards, see Wildcards in topics. For more information about the data formats of topics, see Data formats. |
IotInstanceId | String | No | iot-0pp1n8t*** |
The ID of the instance. You can view the ID of the instance on the Overview page in the IoT Platform console. Notice
For more information, see Overview. |
In addition to the preceding operation-specific request parameters, you must configure common request parameters when you call this operation. For more information, see Common request parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | iot.system.SystemException |
The error code returned if the call fails. For more information, see Error codes. |
ErrorMessage | String | A system exception occurred. |
The error message returned if the call fails. |
RequestId | String | E4C0FF92-2A86-41DB-92D3-73B60310D25E |
The ID of the request. |
Success | Boolean | true |
Indicates whether the call was successful.
|
Examples
Sample requests
http(s)://iot.cn-shanghai.aliyuncs.com/?Action=CreateDataSourceItem
&DataSourceId=1002
&Topic=/as/mqtt/status/gy***z/+
&<Common request parameters>
Sample success responses
XML
format
<CreateDataSourceItemResponse>
<RequestId>E4C0FF92-2A86-41DB-92D3-73B60310D25E</RequestId>
<Success>true</Success>
</CreateDataSourceItemResponse>
JSON
format
{
"RequestId": "E4C0FF92-2A86-41DB-92D3-73B60310D25E",
"Success": true
}