Get All Users
Returns an array of all existing users.
Private fields (a password, for example) aren't included in the response.
Request
HTTP Request
Permissions
A user needs manage-users
permissions to get all possible fields. See the Response section for more information.
If a user doesn't have manage-users
permissions, the response will contain only id
and login
fields.
Warning
For users without manage-users
permissions, a login
field will contain a displayName
field instead.
Path parameters
No parameters required.
Request body
The request body is empty.
Response
Returns an array of all users. See the User model for more information.
The following fields are returned for a newly created class.
Field | Type | Description |
---|---|---|
id | String | User's ID. |
login | String | User's login. If the field isn't specified, a login is created based on a user's email. |
displayName | String | User's display name. Used to hide user's login information. Display name can not be the same as the login . By default, constructed out of login . The first half of the displayName is taken from login , the second is replaced by the * character. |
permissions | Array<String> | An array of permissions available to the user. See an article about permissions for details. |
uiSettings.muteSystemSounds | Boolean | If set to true , system sounds (for example, one that appears after the server is updated) are be disabled. |
objectPermissions.exclude | Array<String> | An array of objects' IDs to which the user has the exclude permission. See an article about permissions for details. |
objectPermissions.include | Array<String> | An array of objects' IDs to which the user has the include permission. See an article about permissions for details. |
contacts | Array<String> | An array of user's contacts (email, phone number, etc). |
eventFilter | Array<EventFilter> | An array of event filters configured for the user. |
status | Integer | User's status. |
The rest of users' public fields are returned if they've been assigned a value. For example, if you add a user to a group, a list of user's groups will be included in the response.
However, even if you set the changed field to the default value (for example, delete a user from all groups
or remove the email
), it would still be included in the response.
Example
Request
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/users";
let auth = "Basic " + btoa(login + ":" + password);
let headers = new Headers();
headers.append("Authorization", auth);
let requestOptions = {
method: "GET",
headers: headers
};
fetch(saymonHostname + path, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log("error", error));
const http = require("http");
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/users";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let options = {
"method": "GET",
"hostname": saymonHostname,
"headers": {
"Authorization": auth
},
"path": path
};
let req = http.request(options, function (res) {
let chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
let body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
req.end();
Response
[
{
"id": "5e21b752308c3c66d64e072c",
"login": "admin",
"group": null,
"authenticationToken": null,
"status": 2,
"eventFilter": [],
"permissions": [
"manage-objects",
],
"contacts": []
},
{
"id": "5e4fc1c77915112ac209e53d",
"login": "John",
"uiSettings": {
"muteSystemSounds": false
},
"status": 2,
"eventFilter": [],
"objectPermissions": {
"include": [
1
],
"exclude": [
"5e21b85b308c3c66d64e07bc"
]
},
"permissions": [],
"contacts": []
},
{
"id": "5e78c51788c61a1fbf34b673",
"login": "Bob",
"status": 2,
"eventFilter": [],
"permissions": [
"manage-links"
],
"contacts": []
}
]