Edit User
To edit a user, use the following request:
PUT /users/:id.xml
PUT /users/:id.json
XML Request Example
curl -i -X PUT -d '<user><email>somemail@example.com</email><first_name>NewName</first_name><last_name>NewLastName</last_name><password>qwe123</password><user_group_id>36</user_group_id><bucket_id>2</bucket_id><role_ids type="array"><role_id>1</role_id></role_ids><additional_fields type="array"><additional_field><name>additional_field_name</name><value>custom_value</value></additional_field></additional_fields><suspend_at>2011-08-01 12:47:08</suspend_at><registered_yubikey>true</registered_yubikey></user>' -u user:userpass http://onapp.test/users/12.xml -H 'Accept: application/xml' -H 'Content-type: application/xml'
JSON Request Example
curl -i -X PUT -H 'Accept: application/json' -H 'Content-type: application/json' -u user:password --url http://onapp.test/users/12.json -d '{"user":{"email":"1111111losj@test.test","first_name":"1111","last_name":"1311","password":"changeme","user_group_id":"1","bucket_id":"1","role_ids":["1","2"], "additional_fields":[{"additional_field":{"name":"additional_field_name","value":"custom_value"}}]}}'
Where:
email - user's email address
first_name - user's first name
last_name - user's last name
password - user's password. (min – 6 characters)
user_group_id - ID of the group, to which the user is attached
bucket_id - ID of the bucket assigned to this user
role_ids - an array of the role IDs, assigned to the user
additional field – an array of custom fields assigned to the user, where:
- name - the name of a particular additional field
- value - the value which you want to assign to this additional field
suspend_at - time in [YYYY][MM][DD] T[hh][mm][ss]Z format, when the user will be suspended
registered_yubikey - set to 'true' if you want to enable logging in using a Yubikey for this user, otherwise set to 'false'. For the API request that adds a YubiKey, refer to Add YubiKey to User.
- To disable user auto-suspending, leave the suspend_at field empty.
- Users with API key instead of password are not allowed to see their login and change their password.
Page History
v. 4.2
- added the registered_yubikey parameter