Validate a Password
POST /v1/validations/password
Validates a password.
User Roles
User Role | Description |
---|---|
ADMIN |
Can issue this request |
MEMBER |
Can issue this request |
anonymous |
Can issue this request |
Request Parameters
Location | Data Item | Type | Required/ Optional | Description |
---|---|---|---|---|
body | data |
object | required | |
body | data.type |
string | required | The type of data (validations_password in this case) |
body | data.attributes |
object | required | |
body | data.attributes.password |
string | required | The password to validate |
Example Request
Note: The
authorization
header is not required for this request.
Header
POST /v1/validations/password HTTP/1.1
Host: api.ampermusic.com
Content-Type: application/vnd.api+json
Body
{
"data": {
"type": "validations_password",
"attributes": {
"password": "Th1sis@g00dPwd$"
}
}
}
Response Data
Data Item | Type | Description |
---|---|---|
data |
object | |
data.type |
string | The type of data (validations_password in this case) |
data.id |
string | The validated password |
data.attributes |
object | |
data.attributes.password |
string | |
data.attributes.score |
number | A subjective measurement between 0 (worst) and 4 (best) of the password complexity. The password must have at least a score of 2 to be considered valid |
data.attributes.suggestions |
array | Zero or more suggestions for improving password quality. A password may be considered valid even if suggestions are returned. |
data.attributes.valid |
boolean | If true , the password is considered valid |
data.attributes.warning |
string | null for valid passwords. If the password is invalid, provides an explanation message |
data.links |
object | |
data.links.self |
string | The account URL. |
links |
object | |
links.self |
string | This account URL. |
|
Example Response — Valid Password
An example response to a request to validate the password “Th1sis@g00dPwd$”.
Header
HTTP/1.1 200 OK
Body
{
"data": {
"type": "validations_password",
"id": "Th1sis@g00dPwd$",
"attributes": {
"password": "Th1sis@g00dPwd$",
"score": 4,
"suggestions": [],
"valid": true,
"warning": null
},
"links" : {
"self" : "https://api.ampermusic.com/v1/validations/password"
},
},
"links" : {
"self" : "https://api.ampermusic.com/v1/validations/password"
}
}
Example Response — Invalid Password
An example response to a request to validate the password “Password”.
Header
HTTP/1.1 200 OK
Body
{
"data": {
"type": "validations_password",
"id": "Password",
"attributes": {
"password": "Password",
"score": 0,
"suggestions": [
"Add another word or two. Uncommon words are better.",
"Capitalization doesn't help very much."
],
"valid": false,
"warning": "This is a top-10 common password.",
},
"links" : {
"self" : "https://api.ampermusic.com/v1/validations/password"
},
},
"links" : {
"self" : "https://api.ampermusic.com/v1/validations/password"
}
}