Purpose: Edit CommCare(mobile-worker) user.
Authentication: For more information, please review CommCare's API Authentication Documentation.
URL: https://www.commcarehq.org/a/[domain]/api/[version]/user/[id]/
Method: PUT
Input Parameters:
Name | Description | Example |
---|---|---|
first_name | First name of user | John |
last_name | Last name of user | Doe |
Email address of user | ||
phone_numbers | List of all phone numbers of the user | (see examples) This will replace existing phone numbers for user. |
groups | List of all group ids belonging to the user | (see examples) This will replace existing groups for the user. |
user_data | Any additional custom data associated with the user | (see examples) This will replace existing custom data for the user. Note that user data may include system data affecting various features, so it is advised to pull the user's current data and edit it, rather than completely overwriting user data. To get the user's current data, use the single user URL provided by the List Mobile Workers API. |
language | User language | en |
password | New password for user | fake-password-123 |
Sample input:
{ "first_name": "John", "last_name": "Doe", "email": "jdoe@example.org", "language": "en", "password": "new password", "phone_numbers": [ "+50253311399", "50253314588" ], "groups": [ "9a0accdba29e01a61ea099394737c4fb", "b4ccdba29e01a61ea099394737c4fbf7" ], "user_data": { "chw_id": "13/43/DFA" } }
Other Information:
- You must specify in the request header that the Content-Type is application/json
2 Comments
user-17768
Just wondering why the update API does not support changing the default_phone_number, as can be done with the create API.
Cory Zue
I believe that when you set the phone numbers the first one will be selected as the default.