Register User

POST /node/api/users/signup

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.

Permissions: ...

Request parameters

Body parameters

Parameter

Type

Description

token

String

required

A token associated with the generated captcha.

captcha

String

required

A captcha entered by the user.

login

String

required

User's login.

email

String

required

User's email.

password

String

required

User's password.

Response description

See the User model.

Examples

Request examples

Bash
JavaScript
NodeJS
Python
Bash
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
JavaScript
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));
NodeJS
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();
Python
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 example

{
"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"
}