Skip to content

Change User's Password

Changes a user's password.

Request

HTTP Request

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

Permissions

No permissions required to change your own password. To change other users' passwords:

manage-users

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

To change the password, you must provide the current password alongside the new one:

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

New password must match system's Password Policy. If it doesn't, the request will return an error, containing the first problem found in the password:

{
    "code": "Internal",
    "message": "caused by Error: Password does not match policy: minimum number of characters - 32"
}

Response

The response body is empty.

Example

Request

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)