logo
In-app Chat
Powered Byspreading
On this page

Query the blocklist


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.

ParameterTypeRequiredDescription
FromUserIdStringYesThe ID of the registered user whose blocklist is to be queried.
LimitNumberYesThe 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.
NextNumberYes

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

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

Response parameters

ParameterTypeDescription
CodeNumberThe return code.
MessageStringThe description of the request result.
RequestIdStringThe request ID.
TotalCountNumberThe total number of blocked friends.
NextNumberThe 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.
BlacklistArray of ObjectThe list of blocked friends.
└UserIdStringThe user ID.
└UserNameStringThe username.
└AvatarSTRINGThe user avatar URL.
└UpdateTimeNumberThe time when a friend was blocked. Unit: milliseconds.

Sample response

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

Previous

Batch unblock users

Next

Check blockships