← Back to team overview

dhis2-users team mailing list archive

Re: Creating Users through Account Invites using Web Api

 

 

Thanks Jim, 

I was using dataviewOrganisationUnit in the call. Will try the just
"organisationUnits" 

Best regards, 

Busoye 

On 2014-09-04 16:34, Jim Grace wrote: 

> 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 [3]. 
> 
> 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 [4] 
> 
> 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 [5]" -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 [1]
>> Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users [1]
>> More help : https://help.launchpad.net/ListHelp [2]
 

Links:
------
[1] https://launchpad.net/~dhis2-users
[2] https://help.launchpad.net/ListHelp
[3]
https://www.dhis2.org/doc/snapshot/en/user/html/dhis2_user_manual_en_full.html#d5e10755
[4] https://apps.dhis2.org/demo/api/users/OYLGMiazHtW.json
[5] https://apps.dhis2.org/demo/api/users/invite

Follow ups

References