I’m have some experience but not super advanced at writing api queries to pull data I need from DHIS2.
I have successfully pulled data for data elements using a call like the one below, but when I input an indicator group or indicator UIDs in the dimension=dx, I get this message:
“Assigned categories cannot be specified when data elements are not specified”.
From what I’ve read in DHIS2 manuals, I should be able to pull data for any data elements or indicators, and all associated category option combos would also be included?? or am I wrong?
Here is the call I am using (it works for data elements uids, but not for indicators UIDs):
Hi Peteria,
I think that error is likely from dimension=co & dimension=ao. These are relevant if you have data elements in you dx dimension but not for indicators.
If you are able to display these indicators (with all the info you need) in the Data Visualizer app then before clicking on Update in the app, open the Network tab (F12 → Network) and check the api request from there. It should work!
Good suggestion from @Gassim , in a similar thought, if you open your indicators in a pivot table, then click Download > Plain Data Source > Download as json , then URL will be the API query youre looking for.
If you want to download indicator values from the API directly into tabular format, Download as HTML, copy the URL, and then change the extension from .HTML+CSS to .CSV