Skip to content

Change User's Password

Changes a user's password.

Request

HTTP Request

PUT /node/api/users/:id/password

Permissions

manage-users If you want to change your own password, no permissions required

Path parameters

Parameter Type Description
id String
required
The ID of a user whose password should be changed.

Body parameters

Parameter Type Description
currentPassword String
required
User's current password.
newPassword String
required
User's new password.

Request body

{
    "currentPassword": "qwerty",
    "newPassword": "qwerty_qwerty"
}

Response

The response body is empty.

Examples

Request examples

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

curl -X PUT $url -u $login:$password \
    -H "Content-Type: application/json" \
    -d @- <<EOF 
{
    "currentPassword": "qwerty",
    "newPassword": "qwerty_qwerty"
}
EOF
let login = <...>
let password = <...>
let saymonHostname = <...>
let userId = <...>
let path = "/node/api/users/" + userId + "/password";
let auth = "Basic " + btoa(login + ":" + password);

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

let data = JSON.stringify({
    "currentPassword": "qwerty",
    "newPassword": "qwerty_qwerty"
});

let requestOptions = {
    method: "PUT",
    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 userId = <...>
let path = "/node/api/users/" + userId + "/password";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");

let options = {
    "method": "PUT",
    "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({
    currentPassword: "qwerty",
    newPassword: "qwerty_qwerty"
});

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

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

body = {
    "currentPassword": "qwerty",
    "newPassword": "qwerty_qwerty"
}

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