How to read data values for more than one data element and organisation unit using the dataValues endpoint of the WebAPI

I want to retrieve data values for a given period for all children and grand children of a top level orgUnit for a fixed list of data elements using the dataValues resource of the WebAPI. I don’t want to import the whole dataset, just the data captured by the data elements I’m interested in. Am not sure this is possible.
I successfully imported the dataelements and corresponding category combos from one dhis2 instance to another. Now i want the data values for only those data elements imported using the WebAPI.

Is there a way to specify more than 1 data element identifier in the Data values query parameters?
I’ve tried using;


but then i get this;

{“httpStatus”:“Conflict”,“httpStatusCode”:409,“status”:“ERROR”,“message”:“Illegal data element identifier: If0pYdi5PuD,A2oyRqZ11uI”}

Is it also possible to read data for the children and grandchildren of a parent orgUnit just like one would do using the dataValueSets resource


Any help here.

1 Like

I figured it out. Both /api/26/dataValueSets end point and /api/26/dataValues endpoint according to the documentation don’t provide for that. Forgive me I was so used to those resources.

However, the The analytics dataValueSet resource available at the /api/26/analytics/dataValueSet endpoint allows for returning aggregated data in the data value set format - what i wanted. See documentation here

I can then use the Data (dx), Period (pe), Organisation unit (ou) dimension query parameters to control data, period and orgUnits to get what i want. I also include the category dimension in the query string (dimension=co) to make sure my payload has data broken down by category option combinations rather than totals;


I hope this can help someone out there who loves do play around with the API to get just about anything.:smiley:


1 Like

Thanks you for the feedback @paleu256!

1 Like