Error on Specifying Filters for Events API

Hello

In version DHIS2 2.36.6 and later versions I get the error Event UIDs and filters can not be specified at the same time when I specify a data element filter in the API call. This works for older versions (2.36.0 and lower). Is this due to any API changes between DHIS2 versions?

Example
Request:

https://play.dhis2.org/2.34.9/api/events?program=IpHINAT79UW&ou=DiszpKrYNg8&fields=dataValues[dataElement,value]&filter=X8zyunlgUfM:eq:Replacement

Response:

{
    "pager": {
        "page": 1,
        "pageCount": 1,
        "total": 0,
        "pageSize": 1
    },
    "events": [
        {
            "dataValues": [
                {
                    "dataElement": "X8zyunlgUfM",
                    "value": "Replacement"
                },
                {
                    "dataElement": "ebaJjqltK5N",
                    "value": "1"
                },
                {
                    "dataElement": "bx6fsa0t90x",
                    "value": "false"
                },
                {
                    "dataElement": "wQLfBvPrXqq",
                    "value": "NVP only"
                },
                {
                    "dataElement": "a3kGcGDCuk6",
                    "value": "11"
                },
                {
                    "dataElement": "UXz7xuGCEhU",
                    "value": "3843"
                }
            ]
        }
    ]
}

For 2.37.2
Request:

https://play.dhis2.org/2.37.2/api/events?program=IpHINAT79UW&ou=DiszpKrYNg8&fields=dataValues[dataElement,value]&filter=ebaJjqltK5N:eq:0&page=1

Response:

{
    "httpStatus": "Conflict",
    "httpStatusCode": 409,
    "status": "ERROR",
    "message": "Event UIDs and filters can not be specified at the same time"
}

Thank you for your question @nnkogift! I have asked for support to this and have been trying to investigate it myself as soon as I saw your post. :pray:

1 Like

Did this ever get reported as a bug? It seems to still be an issue.

I’m actually realizing my response is a bit different… on both the events and tracker/events endpoints, data element filters do not seem to work.

^ works fine.

^ returns nothing

Looking at the documentation, this is the example given: filter=fazCI2ygYkq:eq:PASSIVE
so syntax seems to be correct.

And new tracker endpoint has same behavior

https://dhis2.atlassian.net/browse/DHIS2-17269

1 Like