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

GET /node/api/users

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.

For users without manage-users permissions, a login field will contain a displayName field instead.
[
    {
        "id": "5716383a15ebe5891125d6ca",
        "login": "exampl******"
    },
    {
        "id": "578cf86daa6ca8853bec66df",
        "login": "manually-set-display-name"
    },
    ...
]

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.

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.

  • New user

  • Added a user to a group

  • Removed user from all groups, added email

{
    "id": "62fb8dcd5bf42e66c36afd42",
    "login": "new_user",
    "displayName": "new_****",
    "permissions": [],
    "objectPermissions": {
        "include": [],
        "exclude": []
    },
    "contacts": [],
    "eventFilter": [],
    "status": 2
}
{
    "id": "62fb8dcd5bf42e66c36afd42",
    "login": "new_user",
    "displayName": "new___**__",
    "permissions": [],
    "objectPermissions": {
        "include": [],
        "exclude": []
    },
    "contacts": [],
    "eventFilter": [],
    "status": 2,
    "group": [
        "5a0b26aac9a7733f56b01a14"
    ]
}
{
    "id": "62fb8dcd5bf42e66c36afd42",
    "login": "new_user",
    "displayName": "new_****",
    "permissions": [],
    "objectPermissions": {
        "include": [],
        "exclude": []
    },
    "contacts": [],
    "eventFilter": [],
    "status": 2,
    "group": [],
    "email": "test_email@example.com"
}

Example

Request

  • Bash

  • JavaScript

  • NodeJS

  • Python

login=<...>
password=<...>
saymon_hostname=<...>
url=https://$saymon_hostname/node/api/users

curl -X GET $url -u $login:$password
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();
import requests

login = <...>
password = <...>
saymon_hostname = <...>
url = "https://" + saymon_hostname + "/node/api/users"

response = requests.request("GET", url, auth=(login, password))
print(response.text)

Response

[
    {
        "id": "5e21b752308c3c66d64e072c",
        "login": "admin",
        "group": null,
        "authenticationToken": null,
        "status": 2,
        "eventFilter": [],
        "permissions": [
            "manage-objects",
        ],
        "contacts": []
    },
    {
        "id": "5e4fc1c77915112ac209e53d",
        "login": "John",
        "status": 2,
        "eventFilter": [],
        "objectPermissions": {
            "include": [
                1
            ],
            "exclude": [
                "5e21b85b308c3c66d64e07bc"
            ]
        },
        "permissions": [],
        "contacts": []
    },
    {
        "id": "5e78c51788c61a1fbf34b673",
        "login": "Bob",
        "status": 2,
        "eventFilter": [],
        "permissions": [
            "manage-links"
        ],
        "contacts": []
    }
]