Web API - Finding organization units assigned to a program

Hi there,

Using 2.28 and its web API, I need to find all the organisation units which have been assigned a specific tracker program.

Any idea how I could handle that? (I could loop through all OU and test them, but that is not super beautiful, isn’t it?)

Thanks!

Edouard

Hi Edoard,
Try

dev/api/programs/UID?fields=organisationUnits[id,name]

where UID is the UID of your program.

Regards,

Jason

···

On Wed, Feb 28, 2018 at 10:44 AM, Edouard Lavaud edouard.lavaud@gmail.com wrote:

Hi there,

Using 2.28 and its web API, I need to find all the organisation units which have been assigned a specific tracker program.

Any idea how I could handle that? (I could loop through all OU and test them, but that is not super beautiful, isn’t it?)

Thanks!

Edouard


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

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049

Hello,

For finding all org units assigned to a specific program you could use :

your-web-address/api/programs/the-program-id-you-want-to-view?fields=id,displayName,organisationUnits[id,displayName]

This just shows you the id and the name of the organisation units. For more info you can take a look at the section “Metadata field filter” in the developer manual.

Sincerely.

···

On Wednesday, February 28, 2018, Edouard Lavaud edouard.lavaud@gmail.com wrote:

Hi there,

Using 2.28 and its web API, I need to find all the organisation units which have been assigned a specific tracker program.

Any idea how I could handle that? (I could loop through all OU and test them, but that is not super beautiful, isn’t it?)

Thanks!

Edouard

Oh great! Thanks Jason & Melaeke!

Works like a charm!

···

2018-02-28 11:06 GMT+02:00 Melaeke Serawit smelaeke22@gmail.com:

Hello,

For finding all org units assigned to a specific program you could use :

your-web-address/api/programs/the-program-id-you-want-to-view?fields=id,displayName,organisationUnits[id,displayName]

This just shows you the id and the name of the organisation units. For more info you can take a look at the section “Metadata field filter” in the developer manual.

Sincerely.

On Wednesday, February 28, 2018, Edouard Lavaud edouard.lavaud@gmail.com wrote:

Hi there,

Using 2.28 and its web API, I need to find all the organisation units which have been assigned a specific tracker program.

Any idea how I could handle that? (I could loop through all OU and test them, but that is not super beautiful, isn’t it?)

Thanks!

Edouard

Edouard Lavaud,
MSc in Health Policy, Planning & Financing
MEng in Telecommunication
University Diploma in ICT for Health

Email: edouard.lavaud@gmail.com

Mobile: 0033 6 7210 23 59