User Edit (Mobile Worker)

Purpose: Edit CommCare(mobile-worker) user.

Permissions Required:Ā Edit Mobile Workers & Edit Access API's

Authentication: For more information, please review .

URL:Ā https://www.commcarehq.org/a/[domain]/api/[version]/user/[id]/Ā 

Method: PUT

Input Parameters:Ā 

NameĀ 

DescriptionĀ 

ExampleĀ 

NameĀ 

DescriptionĀ 

ExampleĀ 

first_nameĀ 

First name of userĀ 

JohnĀ 

last_nameĀ 

Last name of userĀ 

DoeĀ 

emailĀ 

Email address of userĀ 

john.doe@example.orgĀ 

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 at https://dimagi.atlassian.net/wiki/x/MDHKfw.

language

User language

en

password

New password for user

fake-password-123

primary_location

The location id of the primary location, it must be one of the locations. To remove the primary_location, pass an empty string.

26fc44e2792b4f2fa8ef86178f0a958e

locations

A list of location_ids that the mobile worker will be assigned to. Location id can be acquired by Location API. To remove all assigned locations, pass an empty array.

["26fc44e2792b4f2fa8ef86178f0a958e", "c1b029932ed442a6a846a4ea10e46a78"]

Sample input:
JSON Input

{ "first_name": "John", "last_name": "Doe", "email": "jdoe@example.org", "language": "en", "password": "new password", "phone_numbers": [ "+50253311399", "50253314588" ], "groups": [ "9a0accdba29e01a61ea099394737c4fb", "b4ccdba29e01a61ea099394737c4fbf7" ], "primary_location": "26fc44e2792b4f2fa8ef86178f0a958e", "locations": ["26fc44e2792b4f2fa8ef86178f0a958e", "c1b029932ed442a6a846a4ea10e46a78"], "user_data": { "chw_id": "13/43/DFA" } }


Other Information:

  • You must specify in the request header that the Content-Type isĀ application/json