Retrieve datavalue with api

Hello all,

I’m trying to retrieve datavalue with the web api but i’m getting de following error :

    "httpStatus": "Conflict",
    "httpStatusCode": 409,
    "status": "ERROR",
    "message": "Data value does not exist"

Here is my request



Hi @didate,

Do you have a datavalue entered for the given Data Element, period & org unit? If you are using disaggregations in your data entry form, then you need to pass additional parameter ‘co’ to get the data value.

1 Like

Hi @didate
You are right. What version of dhis2 are you using? This might be a bug issue because the same error appears on play even though the parameters are correct and the value does exist.

When using the api/analytics we are able to get the value:,pe:202101&filter=ou:DiszpKrYNg8&skipData=false

on the other hand, the api/dataValues returns “Data value does not exist”:

Getting support for this. Thank you @didate and @rithvik (:

@didate would you please like to create a bug issue? (and share the link here)

@rithvik actually got it right! :+1::+1:

@Jason supported this issue and responded that this endpoint requires category option (if you see the api/analytics endpoint it lists the related category options.

If the data element doesn’t have a category option it will work. For example, but the one I mentioned above doesn’t work because we need to mention a co (category option)

You might want to review this section in the docs: Individual Data values


Hello @Gassim and @rithvik thank you for your responses.

I will definitely use the analytics API even if I would have preferred to use the raw data.

We’re trying to migrate some datas from old dhis 2 instance to new one.


1 Like

You’re welcome @didate!

I think you’d be able to get the raw data if you’d add the co in the dataValues endpoint as @rithvik and @jason mentioned.

I remember it was recommended to upgrade the instance itself (or a replicate) when you want to migrate to another instance of a higher version.

Our goal is to migrate part of the data, not all of the instance’s data.

I’m going to continue with the analytics API, it works well. It also allows us to retrieve data for several months at the same time, which reduces the number of requests on the source instance.

Thank you so much

1 Like

@didate ,

You can also make use of Import/Export app to export and import the data needed from one DHIS instance to another. You also get the flexibility to mention the date range and select org units and datasets that need to be exported.


1 Like

@rithvik thank you for your message.

Import/Export app is a great app. But in my use case I don’t want to migrate all dataelement of the dataset. The Dataset in the old instance contains more than 4000 data elements and I only want to migrate data from around 900 data elements. And also I have to make a mapping between the data elements of the two instances.

That’s why I think it’s better to write a script that uses APIs to automate all this.


1 Like