Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 17 Next »

Purpose: get a list of users. The list of users may be presented to the end user as a simple list of user names, where each name includes a hyperlink to access a list of cases owned by the user.

Base URL: https://www.commcarehq.org/a/[domain]/api/v1/users/

Input parameters:

NameDescriptionExample
formatdata format (optional)
Supported: xml (default), json
format=xml
groupGroup UUID (optional)group=ac9d34ff59cf6388e4f5804b12276d8a

Output values:

NameDescriptionExample
idUser UUID3c5a623af057e23a32ae4000cf291339
usernameUser name of user, including domainjdoe@example.commcarehq.org
first_nameFirst name of userJohn
last_nameLast name of userDoe
default_phone_numberPrimary phone number of user+50253311399
emailEmail address of user john.doe@example.org
phone_numbersList of all phone numbers of the user(see examples)
groupsList of all group ids belonging to the user(see examples)
user_dataAny additional custom data associated with the user(see examples)

Sample usage:

https://www.commcarehq.org/a/demo/api/v1/users/?format=xml&limit=5

Sample output:

JSON:

 

{
    meta: {
        limit: 2,
        next: null,
        offset: 0,
        previous: null,
        total_count: 29
    },
    objects: [{
        type: "user",
        id: "3c5a623af057e23a32ae4000cf291339",
        username: "jdoe@example.commcarehq.org",
        first_name: "John",
        last_name: "Doe",
        default_phone_number: "+50253311399",
        email: "jdoe@example.org",
        phone_numbers: [
        "+50253311399",
        "+50253314588"
        ],
        groups: [
        "9a0accdba29e01a61ea099394737c4fb",
        "b4ccdba29e01a61ea099394737c4fbf7"
        ],
        user_data: {
            "chw_id": "13/43/DFA"
        }
    }, {
        type: "user",
        id: "3c5a623af057e23a32ae4000cf2943248",
        username: "jsmith@example.commcarehq.org",
        first_name: "Jane",
        last_name: "Smith",
        default_phone_number: "+50253311388",
        email: "jsmith@example.org",
        phone_numbers: [
        "+50253311388"
        ],
        groups: [],
        user_data: {
            "village": "Patna",
            "husband_name": "Bob Smith"
        }
    }]
}

 

XML:

<users>
    <user id="3c5a623af057e23a32ae4000cf291339" >
        <username>jdoe@example.commcarehq.org</username>
        <first_name>John</first_name>
        <last_name>Doe</last_name>
        <default_phone_number>+50253311399</default_phone_number>
        <email>jdoe@example.org</email>
        <phone_numbers>
            <phone_number>+50253311399</phone_number>
            <phone_number>+50253314588</phone_number>
        </phone_numbers>
        <groups>
            <group id="9a0accdba29e01a61ea099394737c4fb" />
            <group id="b4ccdba29e01a61ea099394737c4fbf7" /> 
        </groups>
        <user_data>
                <chw_id>13/43/DFA</chw_id>
        </user_data>
    </user>
    <user id="3c5a623af057e23a32ae4000cf2943248">
        <username>jsmith@example.commcarehq.org</username>
        <first_name>Jane</first_name>
        <last_name>Smith</last_name>
        <default_phone_number>+50253311388</default_phone_number>
        <email>jsmith@example.org</email>
        <phone_numbers>
            <phone_number>+50253311388</phone_number>
        </phone_numbers>
        <groups />
        <user_data>
                <village>Patna</village>
                <husband_name>Bob Smith</husband_name>
        </user_data>
    </user>
    ...
</users>
  • No labels