Updating users
PATCH /v3/users/{user_id}
Change the name and password of a user with the specified ID.
If the back-end driver does not support this functionality, this
call might return the HTTP Not Implemented (501)
response code.
Source: https://docs.openstack.org/api-ref/identity/v3/index.html?expanded=update-user-detail#update-user
Request
Parameters
Name | In | Type | Description |
---|---|---|---|
user_id
|
path | string | The user ID. |
user
|
body | object | A user object. |
default_project_id (Optional) |
body | string |
The ID of the default project for the user. |
domain_id (Optional) |
body | string | The ID of the new domain for the user. The ability to change the domain of a user is now deprecated, and will be removed in subequent release. It is already disabled by default in most Identity service implementations. |
enabled (Optional) |
body | boolean | Enables or disables the user. An enabled user
can authenticate and receive authorization. A disabled user
cannot authenticate or receive authorization. Additionally, all
tokens that the user holds become no longer valid. If you re-enable
this user, pre-existing tokens do not become valid. To enable the
user, set to true . To disable the user, set to false .
Default is true . |
name (Optional) |
body | string | The new name for the user. Must be unique within the owning domain. |
password (Optional) |
body | string | The password for the user. |
options (Optional) |
body | object | The resource options for the user. Available resource options are
ignore_change_password_upon_first_use , ignore_password_expiry ,
ignore_lockout_failure_attempts , lock_password ,
multi_factor_auth_enabled , and multi_factor_auth_rules ignore_user_inactivity . |
Example
# curl -ks -X PATCH -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' -d ' { "user": { "enabled": true, "password": "newpasswd", "name": "user1_renamed" } }' https://<node_IP_addr>:5000/v3/users/2973892bee384ca6b8c9886f0c4a8815
Response
Parameters
Name | In | Type | Description |
---|---|---|---|
user
|
body | object | A user object. |
default_project_id (Optional) |
body | string |
The ID of the default project for the user. |
domain_id
|
body | string | The ID of the domain. |
enabled
|
body | boolean | If the user is enabled, this value is true .
If the user is disabled, this value is false . |
id
|
body | string | The user ID. |
links
|
body | object | The links for the user resource. |
name
|
body | string | The user name. Must be unique within the owning domain. |
password_expires_at
|
body | string |
The date and time when the password expires. The time zone is UTC. This is a response object attribute; not valid for requests.
A New in version 3.7 |
options
|
body | object | The resource options for the user. Available resource options are
ignore_change_password_upon_first_use , ignore_password_expiry ,
ignore_lockout_failure_attempts , lock_password ,
multi_factor_auth_enabled , and multi_factor_auth_rules ignore_user_inactivity . |
Status codes
Success
Code | Reason |
---|---|
200 - OK
|
Request was successful. |
Error
Code | Reason |
---|---|
400 - Bad Request
|
Some content in the request was invalid. |
401 - Unauthorized
|
User must authenticate before making a request. |
403 - Forbidden
|
Policy does not allow current user to do this operation. |
404 - Not Found
|
The requested resource could not be found. |
409 - Conflict
|
This operation conflicted with another operation on this resource. |
501 - Not Implemented
|
The server either does not recognize the request method, or it lacks the ability to fulfill the request. |
Example
{ "user": { "name": "user1_renamed", "links": { "self": "https://<node_IP_addr>:5000/v3/users/2973892bee384ca6b8c9886f0c4a8815" }, "extra": { "email": "user1@example.com" }, "domain_id": "f2eeaaf15c254d4fa10255796122c8ec", "enabled": true, "options": {}, "id": "2973892bee384ca6b8c9886f0c4a8815", "email": "user1@example.com", "password_expires_at": null } }