Web API dataValueSets endpoint not working with dataelement

Hi community

It seems that dataValueSets API endpoint is not working with a dataelement as a parameter. The error message (E2001) below is quite confusing because it suggests that it actually should. Can anyone please confirm?

Is there another way to get, through the web API, all the data values of a single dataelement (without using the analytics API endpoint, without sqlview and without creating a dataset or dataElementGroup for only 1 dataelement)?


Error message:

{"httpStatus":"Conflict","httpStatusCode":409,"status":"ERROR","message":"At least one data element, data set or data element group must be specified","errorCode":"E2001"}


Hi @ehabets . Please have a look at the documentation for your version. dataElement is not a supported query parameter for this endpoint. You can have a look here for the latest current version.

If you need to get a single data element, I would suggest that you use the /api/analytics endpoint which should provide you the data you need.

Thank you a lot @jason for your feedback. So, you somehow confirm that the error message mentioning the requirement for a data element is a bit confusing.

Using the /api/analytics endpoint doesn’t seem to be a good solution for us as it relies on when the analytics are generated and we rather need “real time” data. Am I correct? If so, I guess we will continue fetching all the data values related to our relevant element group.

Hi @ehabets .
The use of the dataElement parameter for that endpoint is not supported. Since you have not specified any required parameter, I think the error message is correct.

Please have a look at section “Continuous analytics tables” in the docs .

In later versions of DHIS2, it is possible to drastically reduce the amount of time which is required to process the analytics tables, since only data which has been changed will be processed. This should allow you to achieve “near real time” updates of your data.

Thank you a lot @jason for pointing me to the existence of the “Continuous analytics tables” job. Looks indeed like a good option.

1 Like