Thanks all,

I think what you suggest Mark is probably the best solution in this case. 
Having to do only 3-4 requests is ok for dividing into levels. I was more 
worried I'd have to do something like one request per org unit with children.

Subject: Re: [Dhis2-devs] WebAPI getting all orgunits with hierarchy info
From: [email protected]
Date: Mon, 15 Dec 2014 14:44:41 +0100
CC: [email protected]; [email protected]
To: [email protected]

Hey Simen,
Depending on how many organisation units you have you can do something like 
this.
https://apps.dhis2.org/dev/api/organisationUnits.json?fields=id,name,level,parent[id]&paging=false
That will get you all the org units and you could re-create the which are 
children of what org unit by level and parent id.
This is normally very slow however so depending on the amount of org units you 
might want to concider loading the other levels separately eventhough the ping 
is high.
Or you could concider loading the first level first and loading the other 
levels in the background (no matter whether they are used or not.
Kind regards,
Mark [email protected][email protected]+47 970 36 752


On 15 Dec 2014, at 14:37, Jan Henrik Ă˜verland <[email protected]> 
wrote:You can do this by using the fields param.
Go e.g. to https://apps.dhis2.org/dev/dhis-web-pivot -> orgunit tab and have a 
look at the network console when you expand nodes.


On Mon, Dec 15, 2014 at 2:34 PM, Simen Skogly Russnes 
<[email protected]> wrote:


Dear all,

can someone give me a suggestion on how to retrieve all orgunits through the 
WebAPI, including parent-child relationships of orgunits, so that an orgunit 
view can be created similarly to the view in Data Entry and Individual Records 
in DHIS 2? Perhaps it's possible to pass a parameter to api/organisationUnits 
so to include children or something, or in analytics get orgunits to include 
parent when passing the LEVEL-<level> parameter.
The query wouldn't happen very often in the use case, but a low number of 
requests to the WebAPI would be preferable as ping rather than bandwidth is an 
issue.

Regards,
Simen S. Russnes
                                          

_______________________________________________

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

Post to     : [email protected]

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

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



_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

                                          
_______________________________________________
Mailing list: https://launchpad.net/~dhis2-devs
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~dhis2-devs
More help   : https://help.launchpad.net/ListHelp

Reply via email to