logo
In-app Chat
ZIMAudio
On this page

QueryUserOnlineState

GET

https://zim-api.zego.im/

Query the online status of users. Supports querying a single user or batch querying multiple users' online status.

QPS Limit
20 times/s

Request

Query Parameters

    Action stringrequired

    Possible values: [QueryUserOnlineState]

    API prototype parameter

    https://zim-api.zego.im/?Action=QueryUserOnlineState

    AppId uint32required

    💡Public parameter. Application ID, assigned by ZEGOCLOUD. Get it from the ZEGOCLOUD Admin Console.

    SignatureNonce stringrequired

    💡Public parameter. A 16-character hexadecimal random string (hex encoding of 8-byte random number). Refer to Signature example for how to generate.

    Timestamp int64required

    💡Public parameter. Current Unix timestamp, in seconds. Refer to Signature example for how to generate, with a maximum error of 10 minutes.

    SignatureVersion stringrequired

    Possible values: [2.0]

    Default value: 2.0

    💡Public parameter. Signature version number.

    Signature stringrequired

    💡Public parameter. Signature, used to verify the legitimacy of the request. Refer to Signing the requests for how to generate an API request signature.

    UserId string[]required

    Possible values: <= 100

    User ID list to query (who have logged in to the ZIM service by calling the login method on the client, or have completed registration by calling the server-side API). A maximum of 100 user IDs can be queried.

    Example: UserId[]=a&UserId[]=b

    Note

    UserId Only supports numbers, English characters, and '!','#','$','%','&','(',')','+','-',':',';','<','=','.','>','?','@','[',']','^','_',' ','{','}','|','~'。

Responses

OK
Schema
    Code number

    Return code.

    The following only lists the Code and SubCode related to the API business logic. For complete return codes, please refer to Global Return Codes.

    Code / SubCodeDescription
    660000011The number of users exceeds the limit.
    660200001Non-existent user ID.
    User has logged out.
    User was only registered through the server and has never logged in.
    Message string

    Description of the request result.

    RequestId string

    Request ID.

    Result object[]
    Query result of user status. Returned through this field when the user is online or offline.
  • Array[
  • UserId string

    ID of online or offline user.

    Status string

    Possible values: [Online, Offline]

    User status, including:

    • Online:Online.
    • Offline:Offline.
  • ]
  • ErrorList object[]
    Query failure list. Returned through this field when the user ID does not exist or the user has logged out.
    • Code is 0:
    • ErrorList is empty, all user online statuses are successfully queried.
    • ErrorList is not empty, indicating that some user online status queries failed. Please refer to SubCode for processing.
    • Code is not 0:
    • ErrorList is empty, indicating parameter error, API frequency limit, or system error.
    • ErrorList is not empty, indicating that all user online status queries failed.
  • Array[
  • UserId string

    Non-existent user ID or ID of logged out user.

    SubCode number

    Return code when query fails. For complete return codes, please refer to the Code description or Global Return Codes.

  • ]

Previous

Call API Online

Next

Query user information

On this page

Back to top