Getting the List of Online Members in Community Group
Feature Overview
The app admin can retrieve the number of online users in the community according to the Group ID.
API Calling Description
Applicable Group Types
Group Type ID | Is this REST API supported |
Private | Supported, same as the Work (Friends Work Group) in the new version |
Public | Supported |
ChatRoom | Supported, same as the Meeting (Temporary Meeting Group) in the new version |
AVChatRoom | Supported |
Community (Community) | Supported |
Note
The overall update granularity for the number of online users in a Community is 4 minutes.
Due to the large number of people in a Community, the overall granularity for updating the number of online users is 4 minutes. When group members go online or offline, their status will be updated in the next 4-minute cycle because their online status has already been counted in the current cycle.
Sample request URL
https://xxxxxx/v4/million_group_open_http_svc/get_online_member_num?sdkappid=88888888&identifier=admin&usersig=xxx&random=99999999&contenttype=json
Request parameters
The table below only lists the parameters that are modified when calling this interface and their descriptions. For more details on other parameters, please refer to RESTful API Overview.
Parameter | Description |
xxxxxx | The dedicated domain for the country/region where your SDKAppID is located: China: console.tim.qq.com Singapore : adminapisgp.im.qcloud.com Seoul : adminapikr.im.qcloud.com Frankfurt : adminapiger.im.qcloud.com Silicon Valley : adminapiusa.im.qcloud.com Jakarta : adminapiidn.im.qcloud.com |
v4/million_group_open_http_svc/get_online_member_num | Request API |
sdkappid | SDKAppID assigned by the Chat console when an app is created |
identifier | |
usersig | The signature generated by the App Administrator Account. For details on the procedure, see Generate UserSig |
random | A random 32-bit unsigned integer ranging from 0 to 4294967295 |
contenttype | The request format is a fixed value of json |
Maximum calling frequency
200 queries/sec.
Sample request packets
This API is used to get the number of online users in a Community.
{"GroupId":"@TGS#_@TGS#cQVLVHIM62CJ"}
Request packet fields
Field | Type | Attribute | Description |
GroupId | String | Required | Group ID to operate |
Sample response packets
{"ActionStatus": "OK","ErrorInfo": "","ErrorCode": 0,"OnlineMemberNum":1000 // Number of online members}
Response packet fields description
Field | Type | Description |
ActionStatus | String | Result of request processing: OK: Indicates successful processing FAIL: Indicates failure |
ErrorCode | Integer | Error codes: 0: Indicates success Non-zero: Indicates failure |
ErrorInfo | String | Error message |
OnlineMemberNum | Integer | The number of online members in this group |
Error codes
Unless a network error occurs (such as a 502 error), the HTTP return code for this interface is always 200. The real error code and error message are represented by ErrorCode and ErrorInfo in the response body.
The private error codes for this API are as follows:
Error code | Description of Meaning |
10002 | System error, please try again or contact technical support |
10003 | The request command is illegal, please try again or contact technical support |
10004 | Invalid parameter. Please check whether the mandatory fields are filled or if the filled fields meet the protocol requirements based on the ErrorInfo field in the response packet |
10007 | Insufficient permissions, non-Community types do not support obtaining the number of people online |
10010 | The group does not exist, or it once existed but has now been dissolved |
10015 | Group ID is invalid, please check if the Group ID is filled correctly |