Documentation
zim In-app Chat
Documentation
Demo APP
SDK Center
API Center
FAQ
Code Market
Console
Sign Up
Log In
中文站 English
  • Documentation
  • In-app Chat
  • Server APIs
  • User related
  • Query user's online status

Query user's online status

Last updated:2024-10-12 14:20

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.

Parameter Type Required Description
UserId[]
Array of String
Yes
The list of user IDs to be queried, up tp 100 user IDs can be queried.

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

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

Sample request

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

Response parameters

Parameter Type Description
Code
Number
Return code.
Message
String
Description of the request execution result.
RequestId
String
Request ID.
Result
Object
The result fo the quert to the user's online status.
ErrorList
Object
The list of query failures.

Among which, the returned field ErrorList:

Parameter Type Description
SubCode
Number
The returned code when the query fails.

This parameter is only returned when ErrorList is not null.

Sample response

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

Return codes

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

return code Description
660000011
The number of users has exceeded the limit.
Page Directory
  • Free trial
  • 提交工单
    咨询集成、功能及报价等问题
    电话咨询
    400 1006 604
    Get Consulting
    Scan Wechat QR code