Batch queries the connection status of multiple ApsaraMQ for MQTT clients based on multiple client IDs.

Limits

  • The BatchQuerySessionByClientIds operation supports a maximum of 100 queries per second (QPS). For more information, see QPS limits.
  • Each call to the BatchQuerySessionByClientIds operation can query the connection status of ApsaraMQ for MQTT clients that correspond to a maximum of 10 client IDs.
Note Each successful call to the BatchQuerySessionByClientIds operation is calculated as a message transaction per second (TPS). This way, you are billed for the call. For more information, see Billing.

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

ParameterTypeRequiredExampleDescription
ActionStringYesBatchQuerySessionByClientIds

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

ClientIdList.NRepeatListYesClientIdList.1

The serial number of the ApsaraMQ for MQTT client. The value N indicates the Nth client ID.

Note You can batch query the status of ApsaraMQ for MQTT clients that correspond to a maximum of 10 client IDs in a single query. The value range of N is 1 to 10.
InstanceIdStringYespost-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.

RegionIdStringYescn-hangzhou

The region ID of the ApsaraMQ for MQTT instance.

Note For more information about these parameters, see Common parameters and Endpoints.

Response parameters

ParameterTypeExampleDescription
OnlineStatusListArray of OnlineStatusList

The status list of all queried ApsaraMQ for MQTT clients.

ClientIdStringGID_test@0001

The ID of a ApsaraMQ for MQTT client. For more information about client IDs, see Terms.

OnlineStatusBooleantrue

Indicates whether the ApsaraMQ for MQTT client is connected to a ApsaraMQ for MQTT instance. Valid values:

  • true: Connected
  • false: Disconnected
RequestIdString63309FDB-ED6C-46AE-B31C-A172FBA0****

The ID of the request.

Examples

Sample requests

http(s)://onsmqtt.cn-hangzhou.aliyuncs.com/? Action=BatchQuerySessionByClientIds
&ClientIdList.1=ClientIdList.1
&InstanceId=post-cn-0pp12gl****
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

<BatchQuerySessionByClientIdsResponse>
    <OnlineStatusList>
            <ClientId>GID_test@0001</ClientId>
            <OnlineStatus>true</OnlineStatus>
    </OnlineStatusList>
    <OnlineStatusList>
            <ClientId>GID_test@0002</ClientId>
            <OnlineStatus>false</OnlineStatus>
    </OnlineStatusList>
    <RequestId>63309FDB-ED6C-46AE-B31C-A172FBA0****</RequestId>
</BatchQuerySessionByClientIdsResponse>

JSON format

{
    "OnlineStatusList": [
        {
            "ClientId": "GID_test@0001",
            "OnlineStatus": true
        },
        {
            "ClientId": "GID_test@0002",
            "OnlineStatus": false
        }
    ],
    "RequestId": "63309FDB-ED6C-46AE-B31C-A172FBA0****"
}

Error codes

HTTP status codeError codeError messageDescription
404ApiNotSupportThe specified API is not supported.The error message returned because the current operation is not supported.
400CheckAccountInfoFailedAn 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.
400InstancePermissionCheckFailedAn 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.
500InternalErrorAn 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.
400ParameterCheckFailedAn 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.
400PermissionCheckFailedAn 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.
500SystemOverFlowAn error occurred while processing your request. Please try again.The error message returned because throttling is triggered. Please try again.
400InvalidParameter.%sAn 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.