All tracker information using the API

Hi,

Is it possible to view the information of the enrollments and the corresponding data of all program stages using the API? I have read the developer manual, but I cannot get the point of how to retrieve the data.

Thanks

Hi @fernandoshake,
Try this:
[yourinstancedomain]/api/trackedEntityInstances?fields=*&ou=the orgnisation unit&order=created:desc&program=the program&pageSize=number of enrollments to display in a page&page=1&totalPages=true
For example: https://play.dhis2.org/2.37.0/api/trackedEntityInstances?fields=*&ou=DiszpKrYNg8&order=created:desc&program=IpHINAT79UW&pageSize=50&page=1&totalPages=true

1 Like

Hi @Gassim,

I will try as you mentioned and get back. Clicking on the link you have shared, i see the result as XML. How can I get the result as csv?

Thanks

1 Like

You can specify the type of download by just appending the type to the endpoint. So taking @Gassim answer it would be:

https://play.dhis2.org/2.37.0/api/trackedEntityInstances.csv?fields=*&ou=DiszpKrYNg8&order=created:desc&program=IpHINAT79UW&pageSize=50&page=1&totalPages=true

Please check this: Developer Manual - DHIS2 Documentation

1 Like