Batch block users
Overview
You can call this operation to batch block up to 20 users for a user.
If you need a higher limit (1,000 at maximum), contact ZEGOCLOUD technical support.
After users are blocked, the client of the user receives the notification in the following ZIM SDK callbacks.
iOS | Android | macOS | Windows |
---|---|---|---|
blacklistChanged | onBlacklistChanged | blacklistChanged | onBlacklistChanged |
Web | Flutter | React Native | |
blacklistChanged | onBlacklistChanged | blacklistChanged |
Operation prototype
- Request method: POST
- Request URL:
https://zim-api.zego.im/?Action=AddUsersToBlacklist
- Protocol: HTTPS
- QPS limit: 20 calls per second
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 |
---|---|---|---|
FromUserId | String | Yes | The ID of the registered user for whom users are to be blocked. |
UserIds | Array of String | Yes | The list of users to be blocked. Up to 20 user IDs can be included, each of which cannot exceed 32 bytes in length. |
The FromUserId
and UserId
parameters can contain only digits, letters, and the following characters: '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', ' ', ', ', '|', '~'.
Sample request
-
Request URL:
Untitledhttps://zim-api.zego.im/?Action=AddUsersToBlacklist &<Common request parameters>
1 -
Request body:
Untitled{ "FromUserId": "zego_user", "UserIds": [ "user1", "user2", "user3", "user4" ] }
1
Response parameters
Parameter | Type | Description |
---|---|---|
Code | Number | The return code. Note When you request to block multiple users at a time, take note of the following items:
|
Message | String | The description of the request result. |
RequestId | String | The request ID. |
ErrList | Array of Object | The list of failed results.
|
└UserID | String | The ID of the user who fails to be blocked. |
└SubCode | Number | The code returned when the request fails. |
Sample response
{
"Code": 0,
"Message": "success",
"RequestId": "343649807833778782",
"ErrList": [
{
"UserId": "user1",
"SubCode": 660000002
}
]
}
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. |
660300005 | The QPS limit specified in AppID is exceeded. | Try again later. |
660500002 | FromUserId is not registered. | Check whether the user is registered. - If so, contact ZEGOCLOUD technical support. - If not, register the user. |
6607000015 | The target user is not registered. | Check whether the user is registered. - If so, contact ZEGOCLOUD technical support. - If not, register the user. |
660800001 | FromUserId is not registered. | Check whether the user is registered. - If so, contact ZEGOCLOUD technical support. - If not, register the user. |
660800037 | The user has been blocked. | No handling is required. |
660800038 | FromUserId cannot be blocked or unblocked. | Modify the value of the UserIds parameter. |
660800039 | Too many users are included in the list. | Reduce the number of users. |
660800040 | No more users can be blocked, as the number of blocked users exceeds the limit for FromUserId . | No handling is required. |
660800041 | Failed to block all specified users. | For more information, see SubCode of ErrList . |