Queries the connection status of a ApsaraMQ for MQTT client based on a client ID.
Scenarios
The QuerySessionByClientId operation is usually used to track the running status of a connected ApsaraMQ for MQTT client and resolve problems with this client based on the query result. You can enter a client ID to check the connection status and IP address of the ApsaraMQ for MQTT client.
For more information about client IDs, see Terms.
Limits
The QuerySessionByClientId operation supports a maximum of 500 queries per second (QPS). For more information, see QPS limits.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | QuerySessionByClientId | The operation that you want to perform. Set the value to QuerySessionByClientId. |
ClientId | String | Yes | GID_test@@@test | The ID of the ApsaraMQ for MQTT client that you want to query. |
InstanceId | String | Yes | post-cn-0pp12gl**** | The ID of the ApsaraMQ for MQTT instance. The value must match the instance ID used on the ApsaraMQ for MQTT client. You can obtain the instance ID from the instance details page in the ApsaraMQ for MQTT console. |
RegionId | String | Yes | cn-hangzhou | The region ID of the ApsaraMQ for MQTT instance. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
OnlineStatus | Boolean | true | Indicates whether the ApsaraMQ for MQTT client is connected to a ApsaraMQ for MQTT instance. Valid values:
|
RequestId | String | E4581CCF-62AF-44D9-B5B4-D1DBBC0E**** | The ID of the request. |
Examples
Sample requests
http(s)://onsmqtt.cn-hangzhou.aliyuncs.com/? Action=QuerySessionByClientId
&ClientId=GID_test@@@test
&InstanceId=post-cn-0pp12gl****
&RegionId=cn-hangzhou
&<Common request parameters>
Sample success responses
XML
format
<QuerySessionByClientIdResponse>
<OnlineStatus>true</OnlineStatus>
<RequestId>E4581CCF-62AF-44D9-B5B4-D1DBBC0E****</RequestId>
</QuerySessionByClientIdResponse>
JSON
format
{
"OnlineStatus": true,
"RequestId": "E4581CCF-62AF-44D9-B5B4-D1DBBC0E****"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
404 | ApiNotSupport | The specified API is not supported. | The error message returned because the current operation is not supported. |
400 | CheckAccountInfoFailed | An error occurred while checking the account information by the STS token. | The error message returned because the account information of the Security Token Service (STS) token failed to be parsed. |
400 | InstancePermissionCheckFailed | An error occurred while validating the permissions of the instance. Please verify the account that created the instance and its permissions settings. | The error message returned because instance permission verification failed. Check the ownership and authorization policy of the ApsaraMQ for MQTT instance. |
500 | InternalError | An error occurred while processing your request. Try again later. | The error message returned because an internal error occurred to the ApsaraMQ for MQTT instance. Please try again. |
400 | ParameterCheckFailed | An error occurred while validating the parameters. The parameters may be missing or invalid. | The error message returned because parameter verification failed. This parameter may be missing or invalid. |
400 | PermissionCheckFailed | An error occurred while validating the resource permissions. Please check the account that created the instance, topic, and GroupId, and check their permission settings. | The error message returned because resource permission verification failed. Check the permissions and authorization policies of the instance, topic, and group ID. |
500 | SystemOverFlow | An error occurred while processing your request. Please try again. | The error message returned because throttling is triggered. Please try again. |
400 | InvalidParameter.%s | An error occurred while validating the parameter. The parameter may be missing or invalid. | The error message returned because parameter verification failed. This parameter may be missing or invalid. |
For a list of error codes, visit the API Error Center.