← Back to team overview

dhis2-users team mailing list archive

Re: API: Getting all sub-ordinate organisationUnits from a root

 

>
> I think that's it. In that sense, actually ?filter=path:like:uid2 should be
> sufficient to get all descendents of uid2 plus uid2 itself, right?


To get descendants (not ancestors), I think you can use
https://play.dhis2.org/dev/api/organisationUnits/O6uvpzGd5pu?fields=id,name&;
*includeDescendants=true*&paging=false

On Wed, Aug 10, 2016 at 7:51 PM, Uwe Wahser <uwe@xxxxxxxxx> wrote:

> I think that's it. In that sense, actually ?filter=path:like:uid2 should be
> sufficient to get all descendents of uid2 plus uid2 itself, right?
>
> Thanks a lot!
>
> > Morten Olav Hansen <morten@xxxxxxxxx> hat am 10. August 2016 um 20:35
> > geschrieben:
> >
> >
> > Hi Uwe
> >
> > Did you try and have a look at the path property? probably you can use
> > something like ?filter=path:^like:/uid1/uid2/uid3/ to get all ancestors
> of
> > a particular org unit
> >
> > --
> > Morten Olav Hansen
> > Senior Engineer, DHIS 2
> > University of Oslo
> > http://www.dhis2.org
> >
> > On Wed, Aug 10, 2016 at 7:33 PM, Uwe Wahser <uwe@xxxxxxxxx> wrote:
> >
> > > Hi Alex,
> > >
> > > thanks for the quick reply. Seems to be a good starting point.
> > >
> > > I didn't know that these can be used recursively. There doesn't seem
> to be
> > > a
> > > limit to the number of levels, either, so it might be worth trying to
> > > build an
> > > url that points directly at the target level. Not yet sure, though,
> how to
> > > get
> > > the results from the recursive json into a flat structure with kettle.
> > > I'll look
> > > into that tomorrow. Actually I was hoping for something that returns a
> > > simple
> > > flat list of all the subsequent OUs, so any other idea is still
> welcome :-)
> > >
> > > Regards,
> > >
> > > Uwe
> > >
> > > > Alex Tumwesigye <atumwesigye@xxxxxxxxx> hat am 10. August 2016 um
> 18:33
> > > > geschrieben:
> > > >
> > > >
> > > > Dear Uwe,
> > > >
> > > > api/organisationUnits.json?paging=false&fields=id,name,child
> > > ren[id,name,children[id,name,children[id,name]]]
> > > >
> > > > Note the inside children[id,name]
> > > >
> > > > Alex
> > > >
> > > > On Wed, Aug 10, 2016 at 4:10 PM, Uwe Wahser <uwe@xxxxxxxxx> wrote:
> > > >
> > > > > Dear all,
> > > > >
> > > > > is there a way to read a certain organisation with all its
> ancestors on
> > > > > all/specific lower levels via api? Something like the "children"
> > > parameter
> > > > > in
> > > > > the dataValueSets api for the organisationUnits api would be
> helpful
> > > ...
> > > > >
> > > > > The alternative would be looping down the hierarchy level by level
> from
> > > > > outside,
> > > > > which I'd like to avoid.
> > > > >
> > > > > Thanks a lot,
> > > > >
> > > > > Uwe (currently on 2.23, could upgrade to 2.24)
> > > > >
> > > > > _______________________________________________
> > > > > Mailing list: https://launchpad.net/~dhis2-users
> > > > > Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> > > > > Unsubscribe : https://launchpad.net/~dhis2-users
> > > > > More help   : https://help.launchpad.net/ListHelp
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Alex Tumwesigye
> > > >
> > > > Technical Advisor - DHIS2 (Consultant),
> > > > Ministry of Health/AFENET  | HISP Uganda
> > > > Kampala
> > > > Uganda
> > > > +256 774149 775, + 256 759 800161
> > > > Skype ID: talexie
> > > >
> > > > IT Consultant (Servers, Networks and Security, Health Information
> > > Systems -
> > > > DHIS2, Disease Outbreak & Surveillance Systems) & Solar Consultant
> > > >
> > > >
> > > > "I don't want to be anything other than what I have been - one tree
> hill
> > > "
> > >
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>



-- 


*David Huser*
DHIS2 Support Specialist
dhuser@xxxxxxxxxxxxxx | https://baosystems.com | Skype: dafhus | 2900 K
Street, Suite 404, Washington D.C. 20007

Follow ups

References