logo
In-app Chat
ZIMAudio
On this page

UpdateFriendAttributes

POST

https://zim-api.zego.im/

Through this API, you can modify the friend attributes of a user's friends.

After successfully updating friend attributes, users receive modification notifications through the following ZIM SDK callback interface:

iOSAndroidmacOSWindows
friendInfoUpdatedonFriendInfoUpdatedfriendInfoUpdatedonFriendInfoUpdated
WebMini ProgramFlutterReact Native
friendInfoUpdatedfriendInfoUpdatedonFriendInfoUpdatedfriendInfoUpdated
uni-app | uni-app xHarmonyOS
friendInfoUpdatedfriendInfoUpdated
Note

The users corresponding to the parameters FromUserId and UserId have logged in to the ZIM service by calling the login method on the client, or have completed registration by calling the server-side API.

Note
The parameters FromUserId and UserId only support numbers, English characters, and '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?', '@', '[', ']', '^', '_', '{', '}', '|', '~'
Note
QPS Limit: 20 times/s

Request

Query Parameters

    Action stringrequired

    Possible values: [UpdateFriendAttributes]

    API prototype parameter

    https://zim-api.zego.im/?Action=UpdateFriendAttributes

    AppId uint32required

    💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.

    SignatureNonce stringrequired

    💡Public parameter. A 16-character hexadecimal random string (hex encoding of 8-byte random number). Refer to Signature example for how to generate.

    Timestamp int64required

    💡Public parameter. Current Unix timestamp, in seconds. Refer to Signature example for how to generate, with a maximum error of 10 minutes.

    SignatureVersion stringrequired

    Possible values: [2.0]

    Default value: 2.0

    💡Public parameter. Signature version number.

    Signature stringrequired

    💡Public parameter. Signature, used to verify the legitimacy of the request. Refer to Signing the requests for how to generate an API request signature.

Body

required
    FromUserId stringrequired

    Possible values: <= 32 characters

    Update the attribute settings for specified friends of this UserID.

    UserId stringrequired

    Possible values: <= 32 characters

    User whose friend attributes are to be updated.

    Attributes object[]required
    Possible values: <= 5
    New friend attributes. By default, a maximum of 5 attributes can be batch updated at a time.
    Note
    The total length of Key and Value is limited to 1024 bytes. If you need to increase the limit, please contact ZEGOCLOUD Technical Support. It is recommended not to set the limit too high.
  • Array[
  • Key stringrequired

    Possible values: [k0, k1, k2, k3, k4]

    Friend attribute key. Can only be k0, k1, k2, k3, or k4.

    Value stringrequired

    Friend attribute value.

  • ]
  • Action number

    Default value: 0

    Operation on attributes. 0: Set attribute.

Responses

OK
Schema
    Code integer

    Return code.

    The following only lists the Code and SubCode related to the API business logic. For complete return codes, please refer to Global Return Codes.

    Note

    When you initiate a request to update multiple friend attributes at the same time:

    • If 1 or more attributes are successfully updated, Code will return 0. In this case, please refer to the specific information in FailKey to confirm the operation result.
    • If all friend attributes fail to be updated, Code will return the relevant return code. For details, please refer to Global Return Codes.
    Code / SubCodeDescriptionSuggested Solution
    660000001General business error.Please retry or contact ZEGOCLOUD Technical Support.
    660000002Input parameter error。Please check the input parameters。
    660300005The API call frequency exceeds the AppID-level limit.Please try again later.
    660800023The Key value of Attributes does not belong to k0 ~ k4.Please modify the value of Key.
    660800024If it is Code: The total length of all Keys and Values in Attributes passed by this API exceeds the limit.
    If it is SubCode: After adding this Key and Value, the total length of the target user's friend attributes exceeds the limit.
    Please reduce the content length of the related fields.
    660800032Attribute parameters are duplicated.Please modify duplicate parameters.
    Message string

    Operation result description.

    RequestId string

    Request ID.

    FailKey object[]
    Friend attribute modification failure information list.
    • Code is 0:
    • FailKey is empty, all friend attributes are successfully updated.
    • FailKey is not empty, indicating that some friend attributes failed to be updated. Please refer to SubCode for processing.
    • Code is not 0:
    • FailKey is empty, indicating parameter error, API frequency limit, or system error.
    • FailKey is not empty, indicating that all friend attributes failed to be updated.
  • Array[
  • Key string

    Friend attribute key that failed to be modified.

    SubCode number

    Specific failure return code. For complete return codes, please refer to the Code description or Global Return Codes.

  • ]

Previous

Change the alias of a friend

Next

Block users

On this page

Back to top