dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #48683
Re: Import User in DHIS2
Hello Aanyo
You can use the API to do a bulk import of user accounts, you’ll find some information in the developer guide (1)
Here’s an example for creating multiple accounts:
{"users": [
{
"firstName": "John",
"surname": "Doe",
"email": "johndoe@xxxxxxxx",
"id": "HEDxivzocuw",
"userCredentials": {
"username": "johndoe",
"password": "A-password-123",
"userInfo": {"id": "HEDxivzocuw"},
"userRoles": [{"id": "Euq3XfEIEbx"}]
},
"organisationUnits": [{"id": "ImspTQPwCqd"}],
"userGroups": [{"id": "vAvEltyXGbD"}]
},
{
"firstName": "Jane",
"surname": "Doe",
"email": "janedoe@xxxxxxxx",
"id": "jU0dqPmdvtO",
"userCredentials": {
"username": "janedoe",
"password": "A-password-123",
"userInfo": {"id": "jU0dqPmdvtO"},
"userRoles": [{"id": "Euq3XfEIEbx"}]
},
"organisationUnits": [{"id": "ImspTQPwCqd"}],
"userGroups": [{"id": "vAvEltyXGbD"}]
}
]}
Note this is a little different from what you’ll find in the guide, first in this example I prepared the payload for multiple accounts, also I added the id and userInfo.id because in the current version/build the system will not create the accounts if that information is missing.
This should be imported using “http://server/api/25/metadata”; or "http://server/api/metadata”;.
Regards,
JM
1 - https://docs.dhis2.org/2.25/en/developer/html/dhis2_developer_manual_full.html#d8566e11697 <https://docs.dhis2.org/2.25/en/developer/html/dhis2_developer_manual_full.html#d8566e11697>
> El 15/02/2017, a las 07:53, Aanyo AHIAGNO <meloprod7@xxxxxxxxx> escribió:
>
> Hello,
>
> Please, what is the best way to import users in dhis2?
>
>
> AHIAGNO Aanyo
> HISP West Africa
> 0022890962285
Follow ups
References