Links

Get User's Info

Retrieves information about a user, the result is only limited to what the callee has access to view. It supports the field parameter for Query and Fields with the userRooms field, that returns the rooms that the user is part of. The rooms field returns the unread property and this field is variable, based on the setting Unread_Count (Admin Panel => General => Unread_Count), this setting provides the ability to choose between options to count the unread messages.
URL
Requires Auth
HTTP Method
/api/v1/users.info
yes
GET

Query Parameters

Argument
Example
Required
Description
userId or username
BsNr28znDkG8aeo7W
Required
The id or username of the user.

Other Users Example Call

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
http://localhost:3000/api/v1/users.info?userId=BsNr28znDkG8aeo7W

Example Result Regular User Callee

{
"user": {
"_id": "nSYqWzZ4GsKTX4dyK",
"type": "user",
"status": "offline",
"active": true,
"name": "Example User",
"utcOffset": 0,
"username": "example",
"avatarETag": "thwftThP3Band942S",
},
"success": true
}

Example Result Admin Callee that requests user's rooms

curl -H "X-Auth-Token: 9HqLlyZOugoStsXCUfD_0YdwnNnunAJF8V47U3QHXSq" \
-H "X-User-Id: aobEdbYhXfu5hkeqG" \
http://localhost:3000/api/v1/users.info?userId=BsNr28znDkG8aeo7W&fields={"userRooms": 1}
{
"user": {
"_id": "nSYqWzZ4GsKTX4dyK",
"createdAt": "2016-12-07T15:47:46.861Z",
"services": {
"password": {
"bcrypt": ...
},
"email": {
"verificationTokens": [
{
"token": "...",
"address": "[email protected]",
"when": "2016-12-07T15:47:46.930Z"
}
]
},
"resume": {
"loginTokens": [
{
"when": "2016-12-07T15:47:47.334Z",
"hashedToken": "..."
}
]
}
},
"emails": [
{
"address": "[email protected]",
"verified": true
}
],
"type": "user",
"status": "offline",
"active": true,
"roles": [
"user"
],
"name": "Example User",
"lastLogin": "2016-12-08T00:22:15.167Z",
"statusConnection": "offline",
"utcOffset": 0,
"username": "example",
"avatarETag": "thwftThP3Band942S",
"rooms": [
{
"_id": "PoffwDEebAwcmS5A8",
"rid": "GENERAL",
"name": "general",
"t": "c",
"unread": 1
},
{
"_id": "hr93s8GcJedZbkeaH",
"rid": "oaqXoFLru3YLuau2J",
"name": "test",
"t": "c",
"unread": 1,
"roles": [
"owner"
]
}
]
},
"success": true
}

Change Log

Version
Description
3.4.0
Added unread property inside rooms object
0.70.0
Added rooms property to response if the user request it and has the view-other-user-channels permission
0.49.0
Updated to support userId or username
0.48.0
Renamed to users.info
0.35.0
Added as user.info