← Back to team overview

dhis2-users team mailing list archive

Event filtering

 

Hi everyone!
I noticed that querying for the /api/events endpoint no longer returns all the events as it used to do and requires the orgUnit, program, trackedEntityInstance or event to return the data. We wanted to query for all the events using the startDate property only to be able to get all the new events on the system.
Is there another way to get all the events or to filter them only by date again?
On a related note, we also needed to make a query asking for events inside a group of orgUnits, and filter them by values of data elements and I was wondering if the "filter" function is available on this endpoint, I coudln't get it to work. Ideally the query would look like:
/api/events.json?&fields=orgUnit, orgUnitName, program[name, id], dataValues[dataElement, value, value::isEmpty]&filter=dataValues.value:ne:VALIDATED&filter=orgUnit:in:[%ids%]
I believe that from the events endpoint doing program[name,id] won't work since the information is not there so a new query searching for each program name would be needed, but is it possible to use the "filter" here? would it be possible to filter the response from a set of orgUnits? Is it possible to filter also the dataElements values? 
I've seen too that the value::isEmpty is not returning the dataElements that are empty, just the ones that are not and also overwrites the value property, would it be possible to send a query to get only the events that have a certain dataElement empty?
I'm sorry for all the questions but I couldn't find these topics on the documentation
Thank you for your time!Eric