Creates a custom topic category for a product.
QPS limits
You can call this operation up to one time per second per account.
Debugging
Request parameters
Parameter |
Type |
Required |
Example |
Description |
Action | String | Yes | CreateProductTopic | The operation that you want to perform. Set the value to CreateProductTopic. |
Operation | String | Yes | PUB | The permissions of a device on the custom topic category. Valid values:
|
ProductKey | String | Yes | aldDEin**** | The ProductKey of the product for which you want to create the custom topic category. |
TopicShortName | String | Yes | submit | The name of the custom topic category. A topic category consists of several fields. Separate the fields with forward slashes ( Note If you set Operation to SUB, you can specify the plus sign ( + ) and number sign (# ) wildcard characters in the name of a topic category to allow devices to subscribe to multiple topics at a time. For more information about how to use wildcard characters, see Custom topics with wildcard characters.
|
IotInstanceId | String | No | iot_instc_pu****_c*-v64******** | The ID of the instance. You can view the ID of the instance on the Overview tab in the IoT Platform console. Important
For more information about instances, see Overview. |
Desc | String | No | submit a test topic | The description of the custom topic category. The description can be up to 100 characters in length. |
EnableProxySubscribe | Boolean | No | false | If you set Operation to SUB or ALL, you can enable the delegated subscription feature. Valid values:
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. |
Codec | String | No | compress | Specifies whether to enable the data compression or decompression feature for a custom topic. This parameter is available only if you use a Standard or Exclusive Enterprise Edition instance. Valid values:
For more information, see Data compression. Important If you specify a value that contains wildcard characters, including the plus sign ( + ) and number sign (# ), for TopicShortName, you cannot configure Codec. If the data compression or decompression feature is enabled when you use the wildcard characters to create a topic category, the call fails.
|
In addition to the preceding operation-specific request parameters, you must configure common request parameters when you call this operation. For more information about common request parameters, 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 | FCC27691-9151-4B93-9622-9C90F30542EC | The ID of the request. |
Success | Boolean | true | Indicates whether the call was successful. Valid values:
|
TopicId | Long | 10000 | The ID of the custom topic category. The ID is issued by IoT Platform if the call is successful. Note Keep the custom topic category ID confidential. The custom topic category ID is required when you call specific operations that are related to the custom topic category. |
Examples
Sample requests
https://iot.cn-shanghai.aliyuncs.com/?Action=CreateProductTopic
&ProductKey=aldDEin****
&TopicShortName=submit
&Operation=PUB
&Desc=submit a test topic
&<Common request parameters>
Sample success responses
XML
format
<CreateProductTopicResponse>
<RequestId>FCC27691-9151-4B93-9622-9C90F30542EC</RequestId>
<Success>true</Success>
<TopicId>10000</TopicId>
</CreateProductTopicResponse>
JSON
format
{
"RequestId":"FCC27691-9151-4B93-9622-9C90F30542EC",
"Success":true,
"TopicId":10000
}
Error codes
For a list of error codes, see Service error codes.