Queries the topics to which a device has subscribed.

QPS limits

You can call this operation up to 100 times per second per account.

Note The RAM users of an Alibaba Cloud account share the quota of the account.

Debugging

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 QueryDeviceSubTopic

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

ProductKey String Yes hf768****

The ProductKey of the product to which the device belongs.

You can use the IoT Platform console or call the QueryProductList operation to view the information about all products within the current Alibaba Cloud account.

DeviceName String Yes device1

The name of the device.

You can use the IoT Platform console or call the QueryDeviceInfo operation to view the information about the device.

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

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

Important
  • If your instance has an ID, you must specify the ID for this parameter. If you do not specify the instance ID, the call fails.
  • If the Overview page or instance ID is not displayed in the IoT Platform console, you do not need to configure 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 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. The ID uniquely identifies this request.

Success Boolean true

Indicates whether the call was successful.

  • true: The call was successful.
  • false: The call failed.
TopicList Array of topic

The information about the topics to which the device has subscribed. This parameter is returned if the call was successful.

Timestamp Long 1662039965873

The time when the device subscribed to a topic. Unit: milliseconds.

TopicName String /hf768****/device1/user/test

The name of the topic.

Examples

Sample requests

http(s)://iot.cn-shanghai.aliyuncs.com/?Action=QueryDeviceSubTopic
&ProductKey=hf768****
&DeviceName=device1
&<Common request parameters>

Sample success responses

XML format

<QueryDeviceSubTopicResponse>
  <RequestId>E4C0FF92-2A86-41DB-92D3-73B60310D25E</RequestId>
  <TopicList>
        <Timestamp>1662039965873</Timestamp>
        <TopicName>/hf768****/device1/user/test</TopicName>
  </TopicList>
  <TopicList>
        <Timestamp>1662039965873</Timestamp>
        <TopicName>/hf768****/device1/user/down</TopicName>
  </TopicList>
  <Success>true</Success>
</QueryDeviceSubTopicResponse>

JSON format

{
    "RequestId": "E4C0FF92-2A86-41DB-92D3-73B60310D25E",
    "TopicList": [
    {
        "Timestamp": 1662039965873,
        "TopicName": "/hf768****/device1/user/test"
    },
    {
        "Timestamp": 1662039965873,
        "TopicName": "/hf768****/device1/user/down"
    }
    ],
    "Success": true
}