Skip to content

Register User

Creates a new user and sends a confirmation message to a user's email. Before using this method, you have to generate a CAPTCHA using the Generate Captcha method. To make this method work, you have to set the field server.user.auth_enabled of a configuration file to true.

Request

HTTP Request

POST /node/api/users/signup

Permissions

manage-users

Path parameters

No parameters required.

Body parameters

Parameter Type Description
captcha String
required
A CAPTCHA entered by the user.
email String
required
User's email.
login String
required
User's login.
password String
required
User's password.
token String
required
A token associated with the generated CAPTCHA.

Request body

{
    "token": "5c2ef019-cca8-40de-b306-050dd976c743",
    "captcha": "1qTY",
    "login": "user_login",
    "email": "user_email@mail.com",
    "password": "1111"
}

Response

See the User model.

Example

Request

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

curl -X POST $url -u $login:$password \
    -H "Content-Type: application/json" \
    -d @- <<EOF
{
    "token": "5c2ef019-cca8-40de-b306-050dd976c743",
    "captcha": "1qTY",
    "login": "user_login",
    "email": "user_email@mail.com",
    "password": "1111"
}
EOF
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/users/signup";
let auth = "Basic " + btoa(login + ":" + password);

let headers = new Headers();
headers.append("Content-Type", "application/json");
headers.append("Authorization", auth);

let data = JSON.stringify({
    "token": "5c2ef019-cca8-40de-b306-050dd976c743",
    "captcha": "1qTY",
    "login": "user_login",
    "email": "user_email@mail.com",
    "password": "1111"
});

let requestOptions = {
    method: "POST",
    headers: headers,
    body: data
};

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/signup";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");

let options = {
    "method": "POST",
    "hostname": saymonHostname,
    "headers": {
        "Authorization": auth,
        "Content-Type": "application/json"
    },
    "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);
    });
});

let data = JSON.stringify({
    "token": "5c2ef019-cca8-40de-b306-050dd976c743",
    "captcha": "1qTY",
    "login": "user_login",
    "email": "user_email@mail.com",
    "password": "1111"
});

req.write(data);
req.end();
import requests

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

body = {
    "token": "5c2ef019-cca8-40de-b306-050dd976c743",
    "captcha": "1qTY",
    "login": "user_login",
    "email": "user_email@mail.com",
    "password": "1111"
}

response = requests.request("POST", url, json=body, auth=(login, password))
print(response.text)

Response

{
    "login": "user_login",
    "email": "user_email@mail.com",
    "status": 0,
    "eventFilter": [],
    "objectPermissions": {
        "include": [
            "817",
            "5e84d165866ec23538892f7d"
        ],
        "exclude": [
            "5e84d212866ec23538893061"
        ]
    },
    "permissions": [
        "manage-objects",
        "manage-links",
        "manage-service-properties",
        "view-section-stat",
        "view-section-monitoring",
        "view-section-history-graph"
    ],
    "contacts": [],
    "id": "5ec7ebe421ca22645150af09"
}

See Also