All Products
Search
Document Center

IoT Platform:QueryProductTopic

Last Updated:Dec 11, 2023

Queries the details of the custom topic categories of a product.

QPS limits

You can call this API operation up to three 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 QueryProductTopic

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

ProductKey String Yes HMyB*******

The ProductKey of the product.

IotInstanceId String No iot_instc_pu****_c*-v64********

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

Important
  • If your instance has an ID, you must configure this parameter. Otherwise, the call fails.
  • If your instance does not have an ID, you do not need to configure this parameter.

For more information, see Instance 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.

Data Array of ProductTopicInfo

The custom topic categories returned if the call is successful. For more information, see ProductTopicInfo.

ProductTopicInfo
Codec String compress

Indicates whether the data compression or decompression feature is enabled for the custom topic category.

Valid values:

  • compress: The data compression feature is enabled.
  • decompress: The data decompression feature is enabled.

For more information, see Data compression.

Desc String topicDesc

The description of the custom topic category.

EnableProxySubscribe Boolean false

Indicates whether the delegated subscription feature is enabled.

Valid values:

  • true: The delegated subscription feature is enabled.
  • false: The delegated subscription feature is disabled.

If you enable the delegated subscription feature for a topic, IoT Platform obtains the details of the topic and helps a device subscribe to the topic when you connect the device to IoT Platform.

Id String 821****

The ID of the custom topic category.

Operation String 1

The permissions that you want to grant to the device on the custom topic category. Valid values:

  • 0: Publish.
  • 1: Subscribe.
  • 2: Publish and Subscribe.
ProductKey String HMyB***

The ProductKey of the product.

TopicShortName String /HMyB***/${deviceName}/user/get

The name of the custom topic category.

ErrorMessage String A system exception occurred.

The error message returned if the call fails.

RequestId String B953EAFF-CFF6-4FF8-BC94-8B89F018E4DD

The ID of the request.

Success Boolean true

Indicates whether the call was successful. Valid values:

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

Examples

Sample requests

https://iot.cn-shanghai.aliyuncs.com/?Action=QueryProductTopic
&ProductKey=HMyB*******
&<Common request parameters>

Sample success responses

XML format

<QueryProductTopicResponse>
  <RequestId>310E4A1E-B614-5607-B7DB-55530CAE074A</RequestId>
  <Data>
        <ProductTopicInfo>
              <TopicShortName>/g18******F/${deviceName}/user/get</TopicShortName>
              <EnableProxySubscribe>false</EnableProxySubscribe>
              <Operation>1</Operation>
              <Id>3679****</Id>
              <ProductKey>g18******F</ProductKey>
        </ProductTopicInfo>
        <ProductTopicInfo>
              <TopicShortName>/g18******F/${deviceName}/user/update</TopicShortName>
              <EnableProxySubscribe>false</EnableProxySubscribe>
              <Operation>0</Operation>
              <Id>3679****</Id>
              <ProductKey>g18******F</ProductKey>
        </ProductTopicInfo>
        <ProductTopicInfo>
              <TopicShortName>/g18******F/${deviceName}/user/update/error</TopicShortName>
              <EnableProxySubscribe>false</EnableProxySubscribe>
              <Operation>0</Operation>
              <Id>3679****</Id>
              <ProductKey>g18******F</ProductKey>
        </ProductTopicInfo>
  </Data>
  <Success>true</Success>
</QueryProductTopicResponse>

JSON format

{
    "RequestId": "310E4A1E-B614-5607-B7DB-55530CAE074A",
    "Data": {
        "ProductTopicInfo": [
            {
                "TopicShortName": "/g18******F/${deviceName}/user/get",
                "EnableProxySubscribe": false,
                "Operation": "1",
                "Id": "3679****",
                "ProductKey": "g18******F"
            },
            {
                "TopicShortName": "/g18******F/${deviceName}/user/update",
                "EnableProxySubscribe": false,
                "Operation": "0",
                "Id": "3679****",
                "ProductKey": "g18******F"
            },
            {
                "TopicShortName": "/g18******F/${deviceName}/user/update/error",
                "EnableProxySubscribe": false,
                "Operation": "0",
                "Id": "3679****",
                "ProductKey": "g18******F"
            }
        ]
    },
    "Success": true
}

Error codes

For a list of error codes, see Service error codes.