logo
In-app Chat
Powered Byspreading
On this page

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.

iOSAndroidmacOSWindows
friendInfoUpdatedonFriendInfoUpdatedfriendInfoUpdatedonFriendInfoUpdated
WebFlutter
friendInfoUpdatedonFriendInfoUpdated

Operation prototype

  • 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 Public request parameters section of the Accessing Server APIs topic.

ParameterTypeRequiredDescription
FromUserIdStringYesThe ID of the registered user whose friend's alias is to be changed.
UserIdsArray of ObjectYesThe list of friends whose aliases are to be modified. Up to 20 user IDs can be included at a time.
└UserIdStringYesThe user ID, which cannot exceed 32 bytes in length.
└FriendAliasStringNoThe new alias, which cannot exceed 256 bytes in length.

Sample request

  • Request URL

    Untitled
    https://zim-api.zego.im/?Action=UpdateFriendsAlias
    &<Common request parameters>
    
    1
    Copied!
  • Request body

    Untitled
    {
        "FromUserId": "zego_user",
        "UserIds": [
            {
                "UserId": "user1",
                "FriendAlias": "FriendAlias1"
            },
            {
                "UserId": "user2",
                "FriendAlias": "FriendAlias2"
            }
        ]
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeNumberThe return code.
Note
When you request to change the aliases of multiple friends, take note of the following items:
  • If the alias of one or more friends is successfully changed, 0 is returned. For more information, see ErrorList.
  • If the aliases of all friends fail to be changed, a corresponding code is returned. For more information, see Return codes.
MessageStringThe description of the operation result.
RequestIdStringThe request ID.
ErrorListArray of Object

The list of failed results.

  • If Code is 0:

    • If ErrorList is empty, the aliases of all friends are successfully changed.
    • If ErrorList is not empty, the aliases of some friends fail to be changed. In this case, see SubCode.
  • If Code is not 0:

    • If ErrorList is empty, one or more parameters are invalid, the QPS limit is exceeded, or a system error occurs.
    • If ErrorList is not empty, the aliases of all friends fail to be changed.
└UserIdStringThe ID of the friend whose alias fails to be changed.
└SubCodeNumberThe code returned when the request fails.

Sample response

Untitled
{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782",
    "ErrorList": [
        {
            "UserId": "aaa",
            "SubCode": 660000012,
            "SubMessage": "user length limit"
        },
        {
            "UserId": "bbb",
            "SubCode": 660000013,
            "SubMessage": "this is a demo"
        }
    ]
}
1
Copied!

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 CodeDescriptionSolution
660000001A common service error occurred.Try again, or contact ZEGOCLOUD technical support.
660000002Invalid parameter.Check the input parameter.
660300005The QPS limit specified in AppID is exceeded.Try again later.
660800019The 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.
660800021The length of the FriendAlias parameter exceeds the limit.Reduce the parameter length.
660800034This user is not a friend of FromUserId.Send a friend request to this user.

Previous

Check friendships

Next

Modify the attributes of a friend