Failing to Query Data Using /api/dataValueSets endpoint (Error 409)

Hi Devs. I am failing to get data from the /dataValueSets api with an error 409. May you find the screenshot attached and Kindly assist. This is occuring even if I pass the orgUnit or ouMode

Version: 2.37.6

Hi @Adriano_Mutize

Kindly share the query that you are using…you can remove/hid your fully qualified domain name (FQDN).

Thanks

Hi @antony.sibanda. Here are the 2 queries i tried.
//api/dataValueSets.json?orgUnit=xxxxxxxxxxxxxxxx
//api/dataValueSets.json?ouMode=ALL

Depending on how you wanna read the data:

  1. dataValueSets.json?dataSet=dataSetId&period=period&orgUnit=orgUnit

  2. dataValueSets.json?dataElementGroup=dataElementGroupId&period=period&orgUnit=orgUnit

  3. dataValueSets.json?dataElement=dataElementId&period=period&orgUnit=orgUnit

you have to replace the bold items

Hi @Adriano_Mutize

you can use below end point

/api/dataValueSets?orgUnit=org_unit_id_here&period=202304&dataSet=dataset_id_here

Thanks

Thanks. @antony.sibanda these queries seem to be returning only one object. I need a list of dataValueSets. Is there a way I can get it.

Maybe if you’d use the SQL View in Maintenance app then when it generates the table with the values you need, you could retrieve it using the API. :slight_smile:

here’s a query on the play server it returns serveral values in the dataValues field

https://play.im.dhis2.org/stable-2-39-5/api/dataValueSets.json?dataSet=BfMAe6Itzgt&orgUnit=TmCsvdJLHoX&period=202101

image

note that

  • when there’s no value the dataValues field can be missing depending on your version (instead of empty array)
  • you can’t pass dataElementGroup and dataSet at the same time (you’ll get only the data of one of the two)

if you have only 1 value… it’s perhaps because

  • you only have one value for that orgunit and period,
  • your user is not allowed to see all the (attribute) category combo.