Check user online status
Query a user's current online status.
This API has rate limits and should not be called frequently. Use it for admin dashboards to display user status or to verify whether a user's client has successfully connected to the messaging service.
tip
For real-time user status change notifications, enable the Subscribe to user online status service. See Subscribe to user online status.
Request method
POST: https://Base URL/v4/user/online-status/get
Rate limit: 100 requests per second
Signature required: All server API requests require signature verification. See API request signature.
Request body
The request body is in application/json format and supports the following parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
userId | String | Yes | The user ID. |
Request example
HTTP
POST /v4/user/online-status/get HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: xxxxxxxxxxxxxxxx
Content-Type: application/json
{
"userId": "jlk456j5"
}
Response
| Field | Type | Description |
|---|---|---|
code | Number | Status code. 0 indicates success. |
result | Object | Response data. |
result.status | String | User status. 1 = currently online. 0 = currently not online. |
Response example
HTTP
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 0,
"result": {
"status": "1"
}
}