Atom feed of this document
 

 4.1.5. Update User

VerbURIDescription
POSTv2.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]Note

Users who hold the admin role can update users who hold the user role (identity:default) or the admin role (identity:user-admin) for the same tenant.

[Warning]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 userId. Before attempting to update a user, use Get User by ID to obtain the username, email account, and status associated with userId. That's Step 1. Check the returned information carefully; if you are certain that it describes the user you intend to change, proceed with Step 2, updating the user you just examined.

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.

Table 4.5. Update User Request Parameters
NameStyleTypeDescription
X-Auth-TokenHeader​String

You need a valid admin token for access.

The X-Auth-Token header should always be supplied.

userIdTemplate​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
  }
}