Establishes message routing relationships between topics.

Limits

  • You can specify a maximum of 100 destination topics for a source topic.
  • The device to which the source topic belongs must be activated.
  • The source and destination topics support only custom topics.
  • Each Alibaba Cloud account can run a maximum of 50 queries per second (QPS).
    Note RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

Alibaba Cloud provides OpenAPI Explorer to simplify API usage. OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateTopicRouteTable

The operation that you want to perform. Set the value to CreateTopicRouteTable.

DstTopic.N RepeatList Yes /x7aWKW9****/deviceNameTest1/user/add

The list of destination topics. The destination topics subscribe to the source topic that is specified by the SrcTopic parameter. Use the array data type even if you specify only one destination topic. Examples: DstTopic.1=/x7aWKW9****/deviceNameTest1/user/add and DstTopic.2=/x7aWKW9****/deviceNameTest2/user/delete.

SrcTopic String Yes /x7aWKW9****/testDataToDataHub/user/update

The source topic. Example: SrcTopic=/x7aWKW9 ****** /testDataToDataHub/user/update.

IotInstanceId String No iot-cn-0pp1n8t****

The ID of the instance. You can view the instance ID on the Overview page in the IoT Platform console.

Notice
  • If your instance has an ID, you must configure this parameter. If you do not set this parameter, the call fails.
  • If your instance has no Overview page or ID, you do not need to set this parameter.

For more information, see Overview.

In addition to the preceding operation-specific request parameters, you must specify 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 iot.system.SystemException

The error message returned if the call fails.

FailureTopics List ["/2Fx7aWKW9****/FdeviceNameTest2/user/delete"]

The list of topics returned if the call fails.

IsAllSucceed Boolean true

Indicates whether all the message routing relationships between topics are established.

  • true: All the message routing relationships between topics are established.
  • false: Not all the message routing relationships between topics are established.
RequestId String FCC27691-9151-4B93-9622-9C90F30542EC

The ID of the request.

Success Boolean true

Indicates whether the call was successful.

  • true: The call was successful.
  • false: The call failed.

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=CreateTopicRouteTable
&SrcTopic=%2Fx7aWKW9****%2FtestDataToDataHub%2Fuser%2Fupdate
&DstTopic.1=%2Fx7aWKW9****%2FdeviceNameTest1%2Fuser%2Fadd
&DstTopic.2=%2Fx7aWKW9****%2FdeviceNameTest2%2Fuser%2Fdelete
&<Common request parameters>

Sample success responses

XML format

<CreateTopicRouteTableResponse>
  <RequestId>32B9828A-25DD-48E2-8E26-D1664B341940</RequestId>
  <FailureTopics></FailureTopics>
  <Success>true</Success>
</CreateTopicRouteTableResponse>

JSON format

{
    "RequestId": "32B9828A-25DD-48E2-8E26-D1664B341940",
    "FailureTopics": {
        "Topic": []
    },
    "Success": true
}

Error codes

For a list of error codes, visit the API Error Center.