You can call this operation to batch delete up to 20 friends for a user in a one-way or two-way manner. If you need a higher limit (50 at maximum), contact ZEGOCLOUD technical support.
In this example, one-way deletion and two-way deletion are explained.
After friends are deleted, the client of the user receives the friend list update notification in the following ZIM SDK callbacks.
iOS | Android | macOS | Windows | Web |
---|---|---|---|---|
Flutter | React Native | |||
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 whose friends are to be deleted. |
UserIds |
Array of String |
Yes |
The list of IDs of users to be deleted. Up to 20 user IDs can be included. |
DeleteType |
Number |
Yes |
The deletion type. Valid values:
|
The `FromUserId` and `UserId` parameters can contain only digits, letters, and the following characters: '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', ' ', '{', '}', '|', '~'.
Request URL:
https://zim-api.zego.im/?Action=DeleteFriends
&<Common request parameters>
Request body:
{
"FromUserId": "zego_user",
"UserIds": [
"user_id1",
"user_id2"
],
"DeleteType": 1
}
Parameter | Type | Description |
---|---|---|
Code |
Number |
The return code. When you request to delete multiple friends at a time, take note of the following items:
|
Message |
String |
The description of the request result. |
RequestId |
String |
The request ID. |
ErrorList |
Array of Object |
The list of failed results.
|
UserID |
String |
The ID of the user failing to be deleted. |
SubCode |
Number |
The code returned when the request fails. |
{
"Code": 0,
"Message": "success",
"RequestId": "343649807833778782",
"ErrorList": [
{
"UserId": "usera2",
"SubCode": 660800022
}
]
}
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. |
Register FromUserId . |
660800019 |
The number of friends to be deleted at a time exceeds the limit. |
Reduce the number of friends to be deleted at a time. |
660800022 |
Repeated user IDs exist. |
Delete or modify repeated IDs. |
660800033 |
Any string in the UserIds parameter cannot be the same as the value of the FromUserId parameter. |
Modify the string in the UserId parameter that is the same as the value of the FromUserId parameter. |
660800034 |
The user is not a friend of FromUserId . |
No handling is required. |