Change the alias of a friend
Overview
You can call this operation to batch change the aliases of up to 20 friends for a user. If you need a higher limit (50 at maximum), contact ZEGOCLOUD technical support.
After aliases are changed, the user receives the notification in the following ZIM SDK callbacks.
| iOS | Android | macOS | Windows | ||
|---|---|---|---|---|---|
| friendInfoUpdated | onFriendInfoUpdated | friendInfoUpdated | onFriendInfoUpdated | ||
| Web | Flutter | ||||
| friendInfoUpdated | onFriendInfoUpdated |
Request method and endpoint
- Request method: POST
- Request URL:
https://zim-api.zego.im/?Action=UpdateFriendsAlias - 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 Common request parameters section of the Accessing Server APIs topic.
| Parameter | Type | Required | Description |
| FromUserId | String | Yes | The ID of the registered user whose friend's alias is to be changed. |
| UserIds | Array of Object | Yes | The list of friends whose aliases are to be modified. Up to 20 user IDs can be included at a time. |
| └UserId | String | Yes | The user ID, which cannot exceed 32 bytes in length. |
| └FriendAlias | String | No | The new alias, which cannot exceed 256 bytes in length. |
Sample request
-
Request URL
https://zim-api.zego.im/?Action=UpdateFriendsAlias &<Common request parameters> -
Request body
{ "FromUserId": "zego_user", "UserIds": [ { "UserId": "user1", "FriendAlias": "FriendAlias1" }, { "UserId": "user2", "FriendAlias": "FriendAlias2" } ] }
Response parameters
| Parameter | Type | Description |
|---|---|---|
| Code | Number | The return code. Note When you request to change the aliases of multiple friends, take note of the following items:
|
| Message | String | The description of the operation result. |
| RequestId | String | The request ID. |
| ErrorList | Array of Object | The list of failed results.
|
| └UserId | String | The ID of the friend whose alias fails to be changed. |
| └SubCode | Number | The code returned when the request fails. |
Sample response
{
"Code": 0,
"Message": "success",
"RequestId": "343649807833778782",
"ErrorList": [
{
"UserId": "aaa",
"SubCode": 660000012,
"SubMessage": "user length limit"
},
{
"UserId": "bbb",
"SubCode": 660000013,
"SubMessage": "this is a demo"
}
]
}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 |
|---|---|---|
| 660000001 | A common service error occurred. | Try again, or contact ZEGOCLOUD technical support. |
| 660000002 | Invalid parameter. | Check the input parameter. |
| 660300005 | The QPS limit specified in AppID is exceeded. | Try again later. |
| 660800019 | The number of aliases of friends to be changed at a time exceeds the limit. | Reduce the number of friends whose aliases are to be changed at a time. |
| 660800021 | The length of the FriendAlias parameter exceeds the limit. | Reduce the parameter length. |
| 660800034 | This user is not a friend of FromUserId. | Send a friend request to this user. |

