In-app Chat
  • iOS : Objective-C
  • Android
  • Web
  • Flutter
  • React Native
  • Unity3D
  • Windows
  • macOS
  • Introduction
    • Overview
    • Basic concepts
  • Sample app
  • Getting started
  • Client SDKs
    • SDK downloads
    • Release notes
    • Upgrade guide
  • Guides
    • Authentication
    • Manage users
    • Room
    • Group
    • Messaging
    • Call invitation (signaling)
    • Manage sessions
  • Offline push notifications
  • Error codes
  • Client APIs
  • Server APIs
  • Documentation
  • In-app Chat
  • Server APIs
  • User related
  • Change the alias of a friend

Change the alias of a friend

Last updated:2024-03-15 16:23

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.

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.

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.
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.
Message
String
The description of the operation result.
RequestId
String
The request ID.
ErrorList
Array 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.
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.
Page Directory