Hi everyone,
I would like to retrieve individual values/category options of a specific category through the API. How can I achieve this?
Thanks
Hi everyone,
I would like to retrieve individual values/category options of a specific category through the API. How can I achieve this?
Thanks
Dear @dmbantu
Do you mean to get all data values for any data value which belongs to a certain category? There is not one specific call which would allow you to do this in a single step. Raw data values can be retrieved with the dataValueSets
API documented here. You could also use the analytics
API end point to get data values, but you would need to be a lot more specific about what you are requesting. The analytics API is documented here. Either one of these APIs should provide you with the ability to get either raw or processed data, but you will need to supply more parameters than simply the category.
Best regards,
Jason
Hi @jason,
I didn’t mean values but category options of a specific category. In our DHIS 2, there is a big list of CHWs created as category options and assigned to a specific category (HR_CHW). I would like to download this list of chws and share it with the program staff, but I see it is not possible to do this through the import/export App as there we can export only categories and not category options within them, so I am asking if you can help me with an API.
Thanks.
Ah, OK, I see now.
Just use a query like this:
https://play.dhis2.org/40.0.1/api/categories/gtuVl6NbXQV?fields=id,name,categoryOptions[id,name]
Adjust the name of the server to your server and the UID of the category to whichever UID your HR_CHW has. You can also adjust the specific fields to be returned. The metadata API is documented in detail here
Best regards,
Jason