logo
In-app Chat
Powered Byspreading
On this page

Query group member list


Description

Get the user list in a group based on the group ID.

Note

The group ID can be obtained through Query Group List in the app.

Operation prototype

  • Request method: POST
  • Request endpoint: https://zim-api.zego.im/?Action=QueryGroupMemberList
  • Protocol: HTTPS
  • Rate limit: 20 requests/second

Request parameters

Listed below are the parameters specific to this request and part of the public request parameters. For the complete list of public request parameters, see Accessing Server APIs - Public parameters.

ParameterTypeRequiredDescription
GroupIdStringYesThe group ID.
LimitNumberNo

The number of members obtained in a single request. The value range is [0, 1000], that is, up to 1000 members can be returned in a single call to this interface.

When the number of members in the group exceeds the Limit, this interface needs to be called multiple times.

If the number filled in exceeds 1000 or is not filled in, the default value is the maximum value of 1000.

NextNumberNoThe pagination flag. Fill in 0 for the first time, and fill in the value returned last time for subsequent times. If the Next returned is 0, the group member list is complete.

For example, if there are 2500 members in the group and you call this interface to query the group member list:

  • Call this interface for the first time, with Limit set to 1000 and Next set to 0 to query users 1-1000; the value of Next returned in the result is 1.
  • Call this interface for the second time, with Limit set to 1000 and Next set to 1 to query users 1001-2000; the value of Next returned in the result is 2.
  • Call this interface for the third time, with Limit set to 1000 and Next set to 2 to query users 2001-2500; the query is complete, and the value of Next returned in the result is 0.
Note

GroupId only supports digits, English characters, and '!', '#', '$', '%', '&', '(', ')', '+', '-', ':', ';', '<', '=', '.', '>', '?'.

Sample request

  • Sample URL request

    Untitled
    https://zim-api.zego.im/?Action=QueryGroupMemberList
    &<public request parameter>
    
    1
    Copied!
  • Request body:

    Untitled
    {
       "GroupId":"groupA",
       "Limit":1000,
       "Next":0
    }
    
    1
    Copied!

Response parameters

ParameterTypeDescription
CodeNumberThe return code.
MessageStringThe explanation of the request result.
RequestIdStringThe request ID.
TotalCountNumberThe total number of group members when the server starts querying.
NextNumberThe flag for paginated pulling.
MemberListArray of StringThe collection of group member information.
└UserIdStringThe ID of the group member.
└UserNameStringThe name of the group member.
└UserNickNameStringThe nickname of the user in the group.

Sample response

Untitled
{
   "Code": 0,
   "Message": "success",
   "RequestId": "343649807833778782",
   "TotalCount": 1680,
   "Next": 168,
   "MemberList": [
      {
         "UserId": "u1",
         "UserName": "userName1",
         "UserNickName": "userNickName1"
      },
      {
         "UserId": "u2",
         "UserName": "userName2",
         "UserNickName": "userNickName2"
      }
   ]
}
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
660000002Parameter error.Please refer to the request parameters and input the correct parameters.
660600001The group does not exist.Please confirm whether GroupId is correct.
660600003Error when querying the group member list.Please contact ZEGOCLOUD technical support.
660600004The call frequency of the QueryGroupMemberList interface exceeds the limit.The rate limit is 20 requests/second. Please do not exceed the limit.

Previous

Query group list in the app

Next

Remove group member