BatchQuerySessionByClientIds - 批量查询客户端在线状态

更新时间:

根据 Client ID 批量查询客户端在线状态。

接口说明

  • BatchQuerySessionByClientIds 接口的 QPS 为 100。更多信息,请参见 QPS 限制

  • 每次调用 BatchQuerySessionByClientIds 接口最多查询 10 个 Client ID 对应的客户端的在线状态。

  • 每成功调用一次 BatchQuerySessionByClientIds 接口,都会计算为一次消息 TPS,从而影响您的计费。计费详情,请参见计费说明

  • 考虑到性能影响,BatchQuerySessionByClientIds 接口使用内部缓存进行查询,可能会导致数据不一致的情况。如需进行精确查询,建议使用 QuerySessionByClientId 接口查询。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

mq:BatchQuerySessionByClientIds

none

*Instance

acs:mq:{#regionId}:{#accountId}:{#InstanceId}

请求参数

名称

类型

必填

描述

示例值

InstanceId

string

云消息队列 MQTT 版实例的 ID,一定要和客户端实际使用的实例 ID 匹配。您可以在控制台实例详情页面获取该 ID。

post-cn-0pp12gl****

ClientIdList

array

客户端列表。

ClientIdList.1

string

客户端编号,表示第 N 个 Client ID。

说明

单次最多批量查询 10 个 Client ID 的状态,即 N 的取值范围为 1~10。

ClientIdList.1

说明

更多参数说明请参见公共参数服务接入点

返回参数

名称

类型

描述

示例值

object

RequestId

string

公共参数,每个请求的 ID 都是唯一的。

63309FDB-ED6C-46AE-B31C-A172FBA0****

OnlineStatusList

array<object>

客户端状态列表。

object

OnlineStatus

boolean

设备是否在线,取值说明如下:

  • true:在线

  • false:不在线

true

ClientId

string

客户端的 Client ID。Client ID 的详细信息,请参见名词解释

GID_test@0001

示例

正常返回示例

JSON格式

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

错误码

HTTP status code

错误码

错误信息

描述

400 CheckAccountInfoFailed An error occurred while checking the account information by the STS token. 解析STS Token账号信息失败。
400 InstancePermissionCheckFailed An error occurred while validating the permissions of the instance. Please verify the account that created the instance and its permissions settings. 实例权限校验失败,请确认MQTT实例的所属关系以及授权策略。
400 ParameterCheckFailed An error occurred while validating the parameters. The parameters 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. 资源权限校验失败,请检查实例、TopicGroup ID的所属权限和授权策略。
400 InvalidParameter.%s An error occurred while validating the parameter. The parameter may be missing or invalid. 参数校验失败,可能缺失或者传入值非法。
500 InternalError An error occurred while processing your request. Try again later. MQTT后端服务异常,请重试。
500 SystemOverFlow An error occurred while processing your request. Please try again. 系统限流,请重试。
404 ApiNotSupport The specified API is not supported. 当前接口不支持,请检查。

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情