本文档 API 接口为最新版本接口,后续相关功能的新增都会在此更新,推荐使用最新版本接口。旧版接口文档请参考历史版本。
通过指定 AppId 和房间 ID,你查询到房间中用户信息,包括存在的用户总数、不可见用户总数、用户终端设备类型等。
Property
为 false
时,QPS 不得超过 40;当请求参数 Property
为 true
时,QPS 不得超过 1。Property
的取值和客户端 SDK版本有关,具体请参见返回参数。下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数。
参数 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
Action | String | 是 | GetRoomOnlineUsers | 接口名称。当前 API 的名称为 GetRoomOnlineUsers 。 |
Version | String | 是 | 2023-11-01 | 接口版本。当前 API 的版本为 2023-11-01 。 |
AppId | String | 是 | 661e****543cf | 你的音视频应用的唯一标志。如何获取 AppId? |
RoomId | String | 是 | Your_RoomId | 要查询的房间 ID,仅支持传入 1 个。 |
Property | Boolean | 否 | false | 是否要获取用户详细信息:
|
RoleType | Integer | 否 | 0 | 注意 该字段仅当 筛选要查询用户的类型。可取值如下:
|
下表仅列出本接口特有的返回参数,公共返回参数请参见返回结构。请求参数 Property
的取值不同,返回也不同。
当请求参数 Property
的值设为 flase
时,返回如下:
参数 | 类型 | 示例值 | 描述 |
---|---|---|---|
RoomExists | Boolean |
| 查询的房间是否存在。
当 |
TotalUser | Integer | 2 | 查询到的用户总数。 |
TotalInvisibleUser | Integer | 1 | 查询到的不可见用户总数。不可见用户最多返回 10000 名。 |
VisibleUserList | String[] | ["normal_user_1"] | 可见用户列表。 |
InvisibleUserList | String[] | ["silent_user_1"] | 不可见用户列表,最多返回 10000 名。 |
当请求参数 Property
的值设为 true
时,返回如下表所示:
参数 | 类型 | 示例值 | 描述 |
---|---|---|---|
RoomExists | Boolean | true | 所查询的房间是否存在:
RoomExists 的值为 false 时,不会返回其他字段。 |
VisibleUserList | Object[] | ["user1","user2"] | 可见用户列表。 注意 可返回的可见用户和不可见用户总数上限为 200 名,若用户总数超过上限,优先返回可见用户。 |
UserId | String | user1 | 用户 ID。 |
DeviceType | String | ios | 用户终端设备的操作系统类型:
|
PlatformType | Integer | 1 | SDK 类型:
注意 仅当 SDK 客户端为 Native 端,且为以下版本时才返回该字段:
|
MediaProcessingType | Integer | 21 | 后端处理业务类型。 注意 仅当用户为后端处理机器人时,才会返回该字段。 取值如下:
|
InvisibleUserList | Object[] | ["silent_user_1"] | 不可见用户列表。 注意 可返回的可见用户和不可见用户数之和上限为 200 名,若用户总数超过上限,优先返回可见用户。 |
UserId | String | user1 | 用户 ID。 |
DeviceType | String | android | 用户终端设备的操作系统类型:
|
PlatformType | Integer | Web | SDK 类型:
注意 仅当 SDK 客户端为 Native 端,且为以下版本时才返回该字段:
|
MediaProcessingType | Integer | 21 | 后端处理的业务类型。 注意 仅当用户为后端处理机器人时,才会返回该字段。 取值如下:
|
GET https://rtc.volcengineapi.com?Action=GetRoomOnlineUsers&Version=2023-11-01&AppId=661e****543cf&RoomId=Room1
{ "ResponseMetadata": { "RequestId": "20230604110420****100232280022D31", "Action": "GetRoomOnlineUsers", "Version": "2023-11-01", "Service": "rtc", "Region": "cn-north-1" }, "Result": { "TotalUser": 2, "TotalInvisibleUser": 1, "VisibleUserList": [ "normal_user_1" ], "InvisibleUserList": [ "silent_user_1" ], "RoomExists": true } }
GET https://rtc.volcengineapi.com?Action=GetRoomOnlineUsers&Version=2023-11-01&AppId=661e****543cf&RoomId=Room1&Property=true
{ "ResponseMetadata": { "RequestId": "", "Action": "GetRoomOnlineUserStatus", "Version": "2023-11-01", "Service": "rtc", "Region": "cn-north-1" }, "Result": { "RoomExist": true, "VisibleUserList": [ { "UserID": "normalUser1", "DeviceType": "ios", }, { "UserID": "normalUser2", "DeviceType": "mac", } ], "InvisibleUserList": [ { "UserID": "segment1", "DeviceType": "linux", "MediaProcessingType": 32, } ] } }
您可访问公共错误码,获取错误码信息。