Import User in DHIS2

Hello,

Please, what is the best way to import users in dhis2?

···

AHIAGNO Aanyo
HISP West Africa

0022890962285

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@mail.com",

    **"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@mail.com",

    **"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

···

AHIAGNO Aanyo
HISP West Africa

0022890962285

1 Like

Bonjour,

Merci pour le mail. Je vais tester.

Regards

···

2017-02-16 2:06 GMT+00:00 JM Alcantara jmalcantara1@gmail.com:

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@mail.com",

    **"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@mail.com",

    **"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

El 15/02/2017, a las 07:53, Aanyo AHIAGNO meloprod7@gmail.com escribió:

Hello,

Please, what is the best way to import users in dhis2?

AHIAGNO Aanyo
HISP West Africa

0022890962285

AHIAGNO Aanyo
HISP West Africa

0022890962285