Query whether a user is in a room
Overview
You can call this operation to query whether a user is in a specified room. By default, you can batch query up to 10 users. If you need a higher limit, contact ZEGOCLOUD technical support.
Operation prototype
- Request method: GET
- Request URL:
https://zim-api.zego.im/?Action=QueryRoomMembers
- Protocol: HTTPS
- QPS limit: 5 calls per second, applicable to group chats only.
Request parameters
The following table describes only the operation-specific request parameters and some common request parameters. For the complete list of common request parameters, see the Public request parameters section of the Accessing Server APIs topic.
Parameter | Type | Required | Description |
---|---|---|---|
UserId[] | Array of String | Yes | The list of user IDs to be queried. By default, up to 10 user IDs can be queried at a time. Example: UserId[]=a&UserId[]=b&UserId[]=c&UserId[]=d |
RoomId | String | Yes | The room ID. |
The UserId
parameter cannot exceed 32 bytes in length, and the RoomID
parameter cannot exceed 128 bytes in length. Both parameters can contain only digits, letters, and the following characters: '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', ' ', ', ', '|', '~'.
Sample request
https://zim-api.zego.im/?Action=QueryRoomMembers
&UserId[]=a&UserId[]=b&UserId[]=c&UserId[]=d&RoomId=roomid
&<Common request parameters>
Response parameters
Parameter | Type | Description |
---|---|---|
Code | Number | The return code. |
Message | String | The description of the request result. |
RequestId | String | The request ID. |
UserList | Object | The query result, that is, the list of users in the specified room. |
└UserId | String | The IDs of users in the specified room. |
└UserName | String | The names of users in the specified room. |
ErrorUser | Object | The list of users not in the specified room.
|
└UserId | String | The IDs of users not in the specified room. |
└SubCode | Number | The return code that indicates the reason for not being in the specified room. |
Sample response
{
"Code": 0,
"Message": "success",
"RequestId": "343649807833778782",
"UserList": [
{
"UserId": "a",
"UserName": "UserNamea"
},
{
"UserId": "b",
"UserName": "UserNameb"
}
],
"ErrorUser": [
{
"UserId": "c",
"SubCode": 660300012
},
{
"UserId": "d",
"SubCode": 660200001
}
]
}
Return codes
The following table describes only the return codes related to the business logic of the operation. For the complete list of return codes, see Return codes.
Return Code | Description | Solution |
---|---|---|
660000002 | Invalid parameter. | Check the input parameter. |
660000011 | Too many users are included in the list. | Check the number of users. |
660200001 | The user ID is not registered. | Check whether the user ID exists or whether the user has logged out of the ZIM service. |
660300006 | The QPS limit is exceeded. | Try again later. |
660300012 | The user is not in the room. | No handling is required. |