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
  • Query the blocklist

Query the blocklist

Last updated:2024-03-15 18:58

Overview

You can call this operation to pull the list of all blocked friends based on user IDs by page.

Operation prototype

  • Request method: GET
  • Request URL: https://zim-api.zego.im/?Action=QueryBlacklist
  • 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 blocklist is to be queried.
Limit
Number
Yes
The number of blocked friends to be pulled per time. Value range: [0, 100]. If this parameter is not specified, is set to 0, or is greater than 100, the value 100 is used.
Next
Number
Yes
The flag for a paginated pull. For the first pull, set this parameter to `0`. For subsequent pulls, enter the value returned from the previous pull. If `Next` is `0` in the returned result, the list of all blocked users is obtained.

For example, if `FromUserId` blocks 250 friends:

  1. In the first call, set `Limit` to `100` and `Next` to `0` to query the first batch of 100 blocked friends in order. In the returned result, `Next` is `num1`.
  2. In the second call, set `Limit` to `100` and `Next` to `num1` to query the second batch of 100 blocked friends in order. In the returned result, `Next` is `num2`.
  3. In the third call, set `Limit` to `100` and `Next` to `num2` to query the third batch of 50 blocked friends in order. In the returned result, `Next` is `0`, indicating the query completes.

Sample request

https://zim-api.zego.im/?Action=QueryBlacklist
&FromUserId=zego
&Limit=100
&Next=2
&<Common request parameters>

Response parameters

Parameter Type Description
Code
Number
The return code.
Message
String
The description of the request result.
RequestId
String
The request ID.
TotalCount
Number
The total number of blocked friends.
Next
Number
The flag for a paginated pull. If this parameter is not 0, information about more blocked friends is to be returned. In this case, set this parameter as needed to pull the remaining information. If this parameter is 0, information of all blocked friends is returned.
Blacklist
Array of Object
The list of blocked friends.
UserId
String
The user ID.
UserName
String
The username.
Avatar
STRING
The user avatar URL.
UpdateTime
Number
The time when a friend was blocked. Unit: milliseconds.

Sample response

{
    "Code": 0,
    "Message": "success",
    "RequestId": "343649807833778782",
    "TotalCount": 500,
    "Next": 1,
    "Blacklist": [
        {
            "UserId": "usera1",
            "UserName": "Nicknamea1",
            "Avatar": "Avatar1",
            "UpdateTime": 1698310534000,
        },
        {
            "UserId": "usera2",
            "UserName": "Nicknamea2",
            "Avatar": "Avatar2",
            "UpdateTime": 1698310534000,
        }
    ]
}

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
660000002
Invalid parameter.
Check the input parameter.
660300005
The QPS limit specified in AppID is exceeded.
Try again later.
660500002
FromUserId is not registered.
Check whether the user is registered. - If so, contact ZEGOCLOUD technical support. - If not, register the user.
660800001
FromUserId is not registered.
Check whether the user is registered. - If so, contact ZEGOCLOUD technical support. - If not, register the user.
Page Directory