| Verb | URI | Description |
|---|---|---|
| POST | v2.0/users/{userId} | Update a user. |
Normal Response Code(s): 200
Error Response Code(s): identityFault (400, 500, …), badRequest (400), unauthorized (401), forbidden (403), badMethod (405), overLimit (413), serviceUnavailable (503), badMediaType (415), itemNotFound (404)
![]() | Note |
|---|---|
Users who hold the admin role can update users who hold
the user role
( |
![]() | Warning |
|---|---|
Before making any change to a user, you should confirm that you are changing the user you intend to change. You can do this by treating every change as a two-step operation: first, check the target of the change; second, make the change.
"Update User" acts upon the user specified by |
To update a user, specify the user's identifying information
(email, username, id, defaultRegion, and status) values,
replacing the current value with a new value where necessary.
For example, to change the user's status from disabled to enabled,
specify enabled=true.
A successful response echoes the requested values.
To update a user's password, include the new password in a request resembling the "Update User Password Request" examples shown below.
| Name | Style | Type | Description |
|---|---|---|---|
X-Auth-Token | Header | String | You need a valid admin token for access. The |
userId | Template | String |
Example 4.13. Update User Request: XML
<?xml version="1.0" encoding="UTF-8"?>
<user xmlns="http://docs.openstack.org/identity/api/v2.0"
xmlns:ns2="http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
xmlns:rax-auth="http://docs.rackspace.com/identity/api/ext/RAX-AUTH/v1.0"
id="123456" username="jqsmith"
enabled="true"
email="john.smith@example.org"
rax-auth:defaultRegion="DFW">
</user>Example 4.14. Update User Request: JSON
{
"user": {
"RAX-AUTH:defaultRegion": "DFW"
"id": "123456",
"username": "jqsmith",
"email": "john.smith@example.org",
"enabled": true
}
}Example 4.15. Update User Password Request: XML
<user username="abc123"
ns1:password="ungu355ab13"
xmlns:ns1="http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
xmlns:ns2="http://docs.openstack.org/identity/api/v2.0" />Example 4.16. Update User Password Request: JSON
{
"user": {
"username": "abc123",
"OS-KSADM:password":"ungu355ab13"
}
}This operation does not require a request body.
Example 4.17. Update User Response: XML
<?xml version="1.0" encoding="UTF-8"?>
<user xmlns="http://docs.openstack.org/identity/api/v2.0"
xmlns:ns2="http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
xmlns:rax-auth="http://docs.rackspace.com/identity/api/ext/RAX-AUTH/v1.0"
id="123456" username="jqsmith"
enabled="true"
email="john.smith@example.org"
rax-auth:defaultRegion="DFW">
</user>Example 4.18. Update User Response: JSON
{
"user": {
"RAX-AUTH:defaultRegion": "DFW"
"id": "123456",
"username": "jqsmith",
"email": "john.smith@example.org",
"enabled": true
}
}
![[Note]](/auth-v2.0-auth-client-devguide/common/images/admon/note.png)
![[Warning]](/auth-v2.0-auth-client-devguide/common/images/admon/warning.png)
