how to insert an organization unit with it's parent org 's code?

hi,all

can you tell me how to insert a org with webapi?

base org info: org name,code,parent code

Thanks

···


此致

林晓东

莫愁前路无知己,天下谁人不识君。

Hi

You can see an example orgunit object here: https://play.dhis2.org/demo/api/organisationUnits/dWOAzMcK2Wt.json?fields=id,name,shortName,code,parent,openingDate

Put that in a json file:

{

“organisationUnits”: [

{

 "name": "kajdlkfjae",

 ...

}

]

}

and do a

curl -X POST “https://play.dhis2.org/demo/api/metadata” -H “Content-Type:application/json” -d @orgunits.json -u admin:district

note that openingDate should be in format ‘YYYY-MM-DD’ (without time at the end).

Best,

David

···

On Tue, Mar 28, 2017 at 11:17 AM, 林晓东 lin_xd@126.com wrote:

hi,all

can you tell me how to insert a org with webapi?

base org info: org name,code,parent code

Thanks


此致

林晓东

莫愁前路无知己,天下谁人不识君。


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp


David Huser
DHIS2 Support Specialist

dhuser@baosystems.com | https://baosystems.com | Skype: dafhus | 2900 K Street, Suite 406, Washington D.C. 20007

Thanks , but I want the message to post using the parent org’s code or name , so no need query the id before inserting :
1644479913(1)

1 Like

@linxd please check out this section in the docs where you’ll find the instructions: Web API Identifier Schemes - Metadata | Using the API - DHIS2 Documentation

Thanks!