Update User

PATCH /node/api/users/:id

Updates a user according to data provided in a request body.
Permissions: manage-users.

Request parameters

Path parameters

Parameter
Type
Description
id
String
required
The ID of a user to be updated.

Body parameters

See the User model.

Response description

See the User model.

Examples

Request examples

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

Response example

1
{
2
"id": "5e82049ba82a7421a9a2d483",
3
"login": "Bob",
4
"eventFilter": [],
5
"permissions": [
6
"manage-links"
7
],
8
"contacts": []
9
}
Copied!
Last modified 1yr ago