Call this operation to create message routing relationships between topics.

Limits

  • A source topic can have a maximum of 100 target topics.
  • The device to which the source topic belongs must be an activated device.

Request parameters

Parameter Type Required Description
Action String Yes The operation that you want to perform. Set the value to CreateTopicRouteTable.
SrcTopic String Yes The message source topic. For example, SrcTopic=/x7aWKW9****/testDataToDataHub/update.
Note System topics (beginning with sys) are not supported.
DstTopic List Yes The list of target topics that subscribe to SrcTopic for messages. The value of this parameter must be in array format, even if there is only one target topic. For example, DstTopic. 1=/x7aWKW9****/deviceNameTest1/addDstTopic. 2=/x7aWKW9****/deviceNameTest2/delete.
Note System topics (beginning with sys) are not supported.
Common Request Parameters - Yes See Common parameters.

Response parameters

Parameter Type Description
RequestId String The globally unique ID generated by Alibaba Cloud for the request.
Success Boolean Indicates whether the call is successful. A value of true indicates that the call is successful. A value of false indicates that the call has failed.
ErrorMessage String The error message returned when the call fails.
Code String The error code returned when the call fails. For more information about error codes, see Error codes.
FailureTopics List The list of failed topics. The routing relationships between these topics and the source topic have not been built.

Examples

Request example

https://iot.cn-shanghai.aliyuncs.com/?Action=CreateTopicRouteTable
&SrcTopic=%2Fx7aWKW9****%2FtestDataToDataHub%2Fupdate
&DstTopic. 1=%2Fx7aWKW9****%2FdeviceNameTest1%2Fadd
&DstTopic. 2=%2Fx7aWKW9****%2FdeviceNameTest2%2Fdelete
&Public Request Parameters

Response example

{
    "RequestId":"FCC27691-9151-4B93-9622-9C90F30542EC",
    "Success":true,
    "FailureTopics":[]
}