← Back to team overview

dhis2-users team mailing list archive

Re: Creating Users through Account Invites using Web Api

 

Hi Busoye,

The documentation, as you may have seen, is at

https://www.dhis2.org/doc/snapshot/en/user/html/dhis2_user_manual_en_full.html#d5e10755
.

I agree that it should be expanded. Meanwhile, here are some additional
tips: To see the format that you should send for a user invitation, try
getting a user in json format through the API, such as:

https://apps.dhis2.org/demo/api/users/OYLGMiazHtW.json

You can use this as general ideas of what json to submit as the user
invite. But you only need to submit a small subset of this. Note that for
an invitation, the email address is essential. For example, the json file
can contain something like:

{
    "email": "noreply@xxxxxxxxx",
    "userCredentials": { "username": "inviteduser" },
    "groups": [ { "id": "wl5cDMuUhmF" }, { "id": "QYrzIjSfI8z" } ],
    "organisationUnits": [ { "id":"ImspTQPwCqd" } ]
}

Edit the email address to your own email for testing, and this json file
should work with:

curl -d @user.json "https://apps.dhis2.org/demo/api/users/invite"; -H
"Content-Type:application/json" -u admin:district -v

This will send an invitation for the user to register, with a preassigned
user name of "invitedUser". If you want the user to pick their own user
name (like what they do when self-registering), you can leave out the
"userCredentials" line. Note that as of now, user roles need to be assigned
in a subsequent API call for the created user.

Hope this helps.

Cheers,
Jim



On Thu, Sep 4, 2014 at 7:33 AM, <busoye@xxxxxxxx> wrote:

>  Hi Morten, Abyot and other DHIS2 users,
>
> I am trying to create users by sending User Account Invites through the
> web api but can't find much in the way of documentation. Can anyone help?
>
> I am using Version:2.16 Build revision:16384
>
> Thanks.
>
> Busoye
>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References