Create Password Policy
Creates a new Password Policy.
Request
HTTP Request
Permissions
Body parameters
Field | Type | Description |
---|---|---|
name | Stringrequired |
Name of the password policy. |
length | Integer | Minimum number of characters. |
minLowercase | Integer | Minimum number of lowercase characters. |
minCapital | Integer | Minimum number of capital characters. |
minDigits | Integer | Minimum number of digits. |
minSpecial | Integer | Minimum number of special characters. Special characters are all characters other than letters and digits. |
Request body
Request body contains a new password policy.
You can omit all fields except name
. Any omitted field will be set to 0
.
Response
This request returns created password policy. See the Password Policy model for more information.
Field | Type | Description |
---|---|---|
id | String | ID of the password policy. |
name | String | Name of the password policy. |
length | Integer | Minimum number of characters. |
minLowercase | Integer | Minimum number of lowercase characters. |
minCapital | Integer | Minimum number of capital characters. |
minDigits | Integer | Minimum number of digits. |
minSpecial | Integer | Minimum number of special characters. Special characters are all characters other than letters and digits. |
Examples
This example creates a new password policy with the minimum password length set to 32
.
Request
let login = <...>
let password = <...>
let saymonHostname = <...>
let path = "/node/api/password-policies/";
let auth = "Basic " + btoa(login + ":" + password);
let headers = new Headers();
headers.append("Content-Type", "application/json");
headers.append("Authorization", auth);
let data = JSON.stringify({
"name": "New Policy",
"length": 32
});
let requestOptions = {
method: "PATCH",
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 path = "/node/api/password-policies/";
let auth = "Basic " + Buffer.from(login + ":" + password).toString("base64");
let options = {
"method": "PATCH",
"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({
"name": "New Policy",
"length": 32
});
req.write(data);
req.end();
Response
Only the length
field was defined in the request. All other fields are set to their default value of 0
.