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
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.

Response description

See the User model.

Examples

Request examples

Bash
JavaScript
NodeJS
Python
1
login=<...>
2
password=<...>
3
saymon_hostname=<...>
4
url=https://$saymon_hostname/node/api/users/signup
5
6
curl -X POST $url -u $login:$password \
7
-H "Content-Type: application/json" \
8
-d @- <<EOF
9
{
10
"token": "5c2ef019-cca8-40de-b306-050dd976c743",
11
"captcha": "1qTY",
12
"login": "user_login",
13
"email": "[email protected]",
14
"password": "1111"
15
}
16
EOF
Copied!
1
let login = <...>
2
let password = <...>
3
let saymonHostname = <...>
4
let path = "/node/api/users/signup";
5
let auth = "Basic " + btoa(login + ":" + password);
6
7
let headers = new Headers();
8
headers.append("Content-Type", "application/json");
9
headers.append("Authorization", auth);
10
11
let data = JSON.stringify({
12
"token": "5c2ef019-cca8-40de-b306-050dd976c743",
13
"captcha": "1qTY",
14
"login": "user_login",
15
"email": "[email protected]",
16
"password": "1111"
17
});
18
19
let requestOptions = {
20
method: "POST",
21
headers: headers,
22
body: data
23
};
24
25
fetch(saymonHostname + path, requestOptions)
26
.then(response => response.text())
27
.then(result => console.log(result))
28
.catch(error => console.log("error", error));
Copied!
1
const http = require("http");
2
3
let login = <...>
4
let password = <...>
5
let saymonHostname = <...>
6
let path = "/node/api/users/signup";
7
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
8
9
let options = {
10
"method": "POST",
11
"hostname": saymonHostname,
12
"headers": {
13
"Authorization": auth,
14
"Content-Type": "application/json"
15
},
16
"path": path
17
};
18
19
let req = http.request(options, function (res) {
20
let chunks = [];
21
22
res.on("data", function (chunk) {
23
chunks.push(chunk);
24
});
25
26
res.on("end", function (chunk) {
27
let body = Buffer.concat(chunks);
28
console.log(body.toString());
29
});
30
31
res.on("error", function (error) {
32
console.error(error);
33
});
34
});
35
36
let data = JSON.stringify({
37
"token": "5c2ef019-cca8-40de-b306-050dd976c743",
38
"captcha": "1qTY",
39
"login": "user_login",
40
"email": "[email protected]",
41
"password": "1111"
42
});
43
44
req.write(data);
45
req.end();
Copied!
1
import requests
2
3
login = <...>
4
password = <...>
5
saymon_hostname = <...>
6
url = "https://" + saymon_hostname + "/node/api/users/signup"
7
8
body = {
9
"token": "5c2ef019-cca8-40de-b306-050dd976c743",
10
"captcha": "1qTY",
11
"login": "user_login",
12
"email": "[email protected]",
13
"password": "1111"
14
}
15
16
response = requests.request("POST", url, json=body, auth=(login, password))
17
print(response.text)
Copied!

Response example

1
{
2
"login": "user_login",
3
"email": "[email protected]",
4
"status": 0,
5
"eventFilter": [],
6
"objectPermissions": {
7
"include": [
8
"817",
9
"5e84d165866ec23538892f7d"
10
],
11
"exclude": [
12
"5e84d212866ec23538893061"
13
]
14
},
15
"permissions": [
16
"manage-objects",
17
"manage-links",
18
"manage-service-properties",
19
"view-section-stat",
20
"view-section-monitoring",
21
"view-section-history-graph"
22
],
23
"contacts": [],
24
"id": "5ec7ebe421ca22645150af09"
25
}
Copied!
Last modified 11mo ago