Queries the device trace of an ApsaraMQ for MQTT client by paging. When a device encounters an exception, you can call this operation to query the connection history of the specified device to help you quickly identify the cause of the exception.
Operation description
Each successful call to the QueryMqttTraceDevice operation counts as one message TPS, which affects your billing. For more information about billing, see Billing.
The queries per second (QPS) limit for a single user on this operation is 500. Exceeding this limit will trigger throttling, which may affect your business. Call this operation appropriately. For more information, see QPS limits.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
mq:QueryMqttDeviceTrace |
none |
*Instance
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| MqttRegionId |
string |
Yes |
The region ID of the ApsaraMQ for MQTT instance. For more information, see Endpoints. |
cn-hangzhou |
| InstanceId |
string |
Yes |
The ID of the ApsaraMQ for MQTT instance. This value must match the instance ID that the client actually uses. You can view the instance ID in the Basic Information area on the Instance Details page in the console. |
mqtt-cn-i7m26mf**** |
| Reverse |
boolean |
No |
Specifies whether to display the results in reverse chronological order. Valid values:
If this parameter is not specified, results are displayed in chronological order by default. |
false |
| ClientId |
string |
Yes |
The client ID of the device whose trace information you want to query. |
GID_test@@@producer |
| BeginTime |
integer |
Yes |
The beginning of the time range to query. Unit: milliseconds. |
1621580400000 |
| EndTime |
integer |
Yes |
The end of the time range to query. Unit: milliseconds. |
1621584000000 |
| CurrentPage |
integer |
Yes |
The number of the page to return. Pages start from page 1. If the value of this parameter exceeds the total number of pages, an empty result is returned. |
1 |
| PageSize |
integer |
Yes |
The maximum number of MSMQ to display on each page for paging. Minimum value: 1. Maximum value: 100. |
5 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| CurrentPage |
integer |
The current page number. |
1 |
| RequestId |
string |
A common parameter. Each request has a unique ID that is active for troubleshooting and locating issues. |
317076B7-F946-46BC-A98F-4CF9777C**** |
| PageSize |
integer |
The maximum number of device activity entries displayed per page. |
2 |
| Total |
integer |
The total number of device activity entries returned. |
3 |
| DeviceInfoList |
array<object> |
The details of the device activity entries. |
|
|
object |
|||
| ChannelId |
string |
The connection identifier of the device. |
c69fe839209547fa9d073781b9cd**** |
| Time |
string |
The time when the device action occurred. |
2021-05-21 15:51:54.867 |
| ActionCode |
string |
The return code of the device action. Valid values:
|
mqtt.trace.action.connect |
| Action |
string |
The device action. Valid values:
|
connect |
| ActionInfo |
string |
The description of the device action. Valid values:
|
accept |
Examples
Success response
JSON format
{
"CurrentPage": 1,
"RequestId": "317076B7-F946-46BC-A98F-4CF9777C****",
"PageSize": 2,
"Total": 3,
"DeviceInfoList": [
{
"ChannelId": "c69fe839209547fa9d073781b9cd****",
"Time": "2021-05-21 15:51:54.867",
"ActionCode": "mqtt.trace.action.connect",
"Action": "connect",
"ActionInfo": "accept"
}
]
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | MqttOwnerCheckError | Failed to validate the instance permission | |
| 400 | MqttInstanceNotFound | Specified instance is not found | |
| 500 | SystemOverFlow | An error occurred while processing your request. Please try again. | |
| 404 | ApiNotSupport | The specified API is not supported. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.