logo
In-app Chat
Powered Byspreading
On this page

Query user's online status


Description

Query the user's online status, and support querying a single user or multiple users' online status in batches.

Rate limit: 20 requests/second

Request method and endpoint

  • Request method: GET
  • Request endpoint: https://zim-api.zego.im/?Action=QueryUserOnlineState
  • Transmission protocol: HTTPS

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
UserId[]Array of StringYes

The list of user IDs to be queried, up tp 100 user IDs can be queried.

For example: UserId[]=a&UserId[]=b

Note

The UserId can only contain numbers, letters, and the following special characters: !#$%&()+-:;<=.>?@[]^_{}|~ .

Sample request

Untitled
https://zim-api.zego.im/?Action=QueryUserOnlineState
&UserId[]=a&UserId[]=b
&<Public parameters>
1
Copied!

Response parameters

ParameterTypeDescription
CodeNumberReturn code.
MessageStringDescription of the request execution result.
RequestIdStringRequest ID.
ResultObjectThe result fo the quert to the user's online status.
ErrorListObjectThe list of query failures.

Among which, the returned field ErrorList:

ParameterTypeDescription
SubCodeNumber

The returned code when the query fails.

This parameter is only returned when ErrorList is not null.

Sample response

Untitled
{
    "Code":0,
    "Message":"success",
    "RequestId":"343649807833778782"
    "Result": [
      {
          "UserId": "id1",
          "Status": "Offline"
      },
      {
          "UserId": "id2",
          "Status": "Online"
      }
    ],
    "ErrorList": [
      {
          "UserId": "id4",
          "SubCode": 1
      }
    ] 
 }
1
Copied!

Return codes

Listed below are the return codes related to this API. For the complete list of return codes, see Return codes.

return codeDescription
660000011The number of users has exceeded the limit.

Previous

Accessing Server APIs

Next

Query user information