Online presence

To retreive the users online status you can use the below API.

info

{api-base-url} can be obtained from the MirrorFly console.

HTTP request#

curl -X GET "https://{api-base-url}/api/v1/users/presence?userIds=99xxxxxx11&userIds=99xxxxxx00&page=1&size=10"
-H "accept: */*"
-H "Authorization: AuthToken"

Request Params#

ParamDataTypeRequiredDescription
userIdsArray of stringsNoUser Ids of the users to retrieve online status
pagenumberNoPage number to get the particular page data default value is 1
sizenumberNoNumber of users per page default value is 10

Responses#

If successful, this action returns a user resource in the response body.

{
"status": 200,
"data": {
"valid":[{
"username": "99xxxxxx11", // String - username of the user
"presence": 1, // Number - Code representing whether user is online(1) or offline(0)
"lastSeen": "1683613192", // String - Unix epoch time in seconds, representing user's last login date
}],
"invalid":[{
"username": "99xxxxxx00", // String - username of the user
"message": "User is not available" // String - Some info describing why username is invalid
}],
"totalPages": 1, // Number - represents the total no.of pages in response
"totalRecords": 1, // Number - represents the total no.of rows matched in db
},
"message": "Data retrieved successfully"
}

Error#

In the case of an error, an error object like below is returned.

When the token passed in Headers is not given or expired

{
"status": 401,
"message": "Token Expired"
}

In the case of a Bad Request, an error message is returned

{
"status": 400,
"message": "Error Message"
}