2017-06-28 14:02:40 -04:00
|
|
|
[role="xpack"]
|
2017-04-06 21:04:39 -04:00
|
|
|
[[security-api-change-password]]
|
|
|
|
=== Change Password API
|
|
|
|
|
|
|
|
The Change Password API enables you to submit a request to change the password
|
2017-09-22 13:00:04 -04:00
|
|
|
of a user.
|
2017-04-06 21:04:39 -04:00
|
|
|
|
2017-09-22 13:00:04 -04:00
|
|
|
==== Request
|
|
|
|
|
|
|
|
`POST _xpack/security/user/_password` +
|
2017-09-22 13:01:49 -04:00
|
|
|
|
|
|
|
`POST _xpack/security/user/<username>/_password`
|
2017-09-22 13:00:04 -04:00
|
|
|
|
|
|
|
|
|
|
|
==== Path Parameters
|
|
|
|
|
|
|
|
`username`::
|
|
|
|
(string) The user whose password you want to change. If you do not specify
|
|
|
|
this parameter, the password is changed for the current user.
|
|
|
|
|
|
|
|
|
|
|
|
==== Request Body
|
|
|
|
|
|
|
|
`password` (required)::
|
|
|
|
(string) The new password value.
|
|
|
|
|
|
|
|
|
|
|
|
==== Authorization
|
|
|
|
|
|
|
|
Every user can change their own password. Users with the `manage_security`
|
|
|
|
privilege can change passwords of other users.
|
|
|
|
|
|
|
|
|
|
|
|
==== Examples
|
|
|
|
|
|
|
|
The following example updates the password for the `elastic` user:
|
2017-04-06 21:04:39 -04:00
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
POST _xpack/security/user/elastic/_password
|
|
|
|
{
|
2017-06-29 16:27:57 -04:00
|
|
|
"password": "x-pack-test-password"
|
2017-04-06 21:04:39 -04:00
|
|
|
}
|
|
|
|
--------------------------------------------------
|
|
|
|
// CONSOLE
|
|
|
|
|
|
|
|
A successful call returns an empty JSON structure.
|
|
|
|
|
|
|
|
[source,js]
|
|
|
|
--------------------------------------------------
|
|
|
|
{}
|
|
|
|
--------------------------------------------------
|
|
|
|
// TESTRESPONSE
|