Queries a Message Service (MNS) or AMQP server-side subscription.
Limits
Each Alibaba Cloud account can run a maximum of 5 queries per second (QPS).
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | QuerySubscribeRelation |
The operation that you want to perform. Set the value to QuerySubscribeRelation. |
ProductKey | String | Yes | a1fyXVF**** |
The ProductKey of the product that is specified for the subscription. |
Type | String | Yes | AMQP |
The type of the subscription. Valid values:
|
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
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 | A system exception occurred. |
The error message returned if the call fails. |
DeviceDataFlag | Boolean | true |
Indicates whether upstream device messages were pushed.
|
DeviceStatusChangeFlag | Boolean | true |
Indicates whether messages about device status changes were pushed.
|
FoundDeviceListFlag | Boolean | true |
Indicates whether messages were pushed if a gateway detected new sub-devices.
|
DeviceTopoLifeCycleFlag | Boolean | true |
Indicates whether messages about topological relationship changes of devices were pushed.
|
DeviceLifeCycleFlag | Boolean | true |
Indicates whether messages about device lifecycle changes were pushed.
|
ThingHistoryFlag | Boolean | true |
Indicates whether upstream historical Thing Specification Language (TSL) data was pushed.
|
OtaEventFlag | Boolean | true |
Indicates whether notifications about the status of OTA update batches were pushed.
|
DeviceTagFlag | Boolean | true |
Indicates whether messages about device tag changes were pushed. Valid values:
Default value: false. |
OtaVersionFlag | Boolean | true |
Indicates whether messages about the version numbers of OTA modules were pushed. Valid values:
Default value: false. |
OtaJobFlag | Boolean | true |
Indicates whether notifications about OTA batch updates were pushed. Valid values:
Default value: false. |
ProductKey | String | a1fyXVF**** |
The ProductKey of the product that is specified for the subscription. |
Success | Boolean | true |
Indicates whether the call was successful.
|
ConsumerGroupIds | List | [DEFAULT_GROUP,br45A6A1amoRFGN7x1zP00****] |
The IDs of the consumer groups that are created in the AMQP subscription. This parameter is returned if the Type parameter is set to AMQP. |
Type | String | AMQP |
The type of the subscription. Valid values:
|
RequestId | String | 21D327AF-A7DE-4E59-B5D1-ACAC8C024555 |
The ID of the request. |
MnsConfiguration | String | { "queueName": "mns-test-topic1", "regionName": "cn-shanghai", "role": { "roleArn": "acs:ram::5645***:role/aliyuniotaccessingmnsrole", "roleName": "AliyunIOTAccessingMNSRole" } } |
The configurations of the MNS queue. This parameter is returned if the Type parameter is set to MNS. For more information, see the "Definition of the MnsConfiguration parameter" section. |
Command |
Description |
---|---|
queueName |
The name of the MNS topic that is used to receive data. |
regionName |
The code of the region in which MNS is deployed. Example: cn-shanghai. |
role |
The information about the RAM role. To grant IoT Platform the access to MNS, you can assign a RAM role to IoT Platform. The following script shows the syntax of a RAM role:
Replace
|
Sample response
{
"queueName": "mns-test-topic1",
"regionName": "cn-shanghai",
"role": {
"roleArn": "acs:ram::5645***:role/aliyuniotaccessingmnsrole",
"roleName": "AliyunIOTAccessingMNSRole"
}
}
Examples
Sample requests
https://iot.cn-shanghai.aliyuncs.com/?Action=QuerySubscribeRelation
&ProductKey=a1Zkii7****
&Type=AMQP
&<Common request parameters>
Sample success responses
XML
format
<QuerySubscribeRelationResponse>
<ConsumerGroupIds>
<e>Xs95KifeaSKbi8tKkcoD00****</e>
</ConsumerGroupIds>
<DeviceDataFlag>false</DeviceDataFlag>
<DeviceLifeCycleFlag>false</DeviceLifeCycleFlag>
<DeviceStatusChangeFlag>false</DeviceStatusChangeFlag>
<DeviceTopoLifeCycleFlag>false</DeviceTopoLifeCycleFlag>
<FoundDeviceListFlag>false</FoundDeviceListFlag>
<OtaEventFlag>true</OtaEventFlag>
<ProductKey>a1Zkii7****</ProductKey>
<RequestId>73B9DF43-7780-47DE-8BED-077729D28BD2</RequestId>
<Success>true</Success>
<ThingHistoryFlag>false</ThingHistoryFlag>
<Type>AMQP</Type>
</QuerySubscribeRelationResponse>
JSON
format
{
"DeviceLifeCycleFlag": false,
"RequestId": "73B9DF43-7780-47DE-8BED-077729D28BD2",
"DeviceDataFlag": false,
"DeviceTopoLifeCycleFlag": false,
"DeviceStatusChangeFlag": false,
"ConsumerGroupIds": [
"Xs95KifeaSKbi8tKkcoD00****"
],
"Success": true,
"ThingHistoryFlag": false,
"Type": "AMQP",
"FoundDeviceListFlag": false,
"OtaEventFlag": true,
"ProductKey": "a1Zkii7****"
}
Error codes
For a list of error codes, visit the API Error Center.