Guys, Trying to export event data in csv format but couldn’t, it downloads blank file.
v2.33 and the url used is : localhost/dhis2/api/29/eventReports/id/data.csv
Appreciate your advice
Guys, Trying to export event data in csv format but couldn’t, it downloads blank file.
v2.33 and the url used is : localhost/dhis2/api/29/eventReports/id/data.csv
Appreciate your advice
Hello @Shady
The API endpoint ‘api/29/eventReports/id’ points to the metadata of the specific event report that you want to save. The metadata doesn’t contain any data, it only contains the information on how to generate a report. The best way is to use the Event Reports app > Download > CSV (.csv).
If you are a programmer and want to somehow download data through the API, the endpoint to download data is (api/29/analytics/events/). There are different parameters you need to provide in order to generate the data, you can look at the documentation at Home - DHIS2 Documentation
Hi @Shady, to follow up on @Melaeke’s point, you can find the parameters used to generate a specific event report by going to Event reports app > Download > HTML. That will open the event analytics query in API in a separate tab. One trick, you can change the extension from “.html+css” to “.csv” in the browser and it will download as CSV.
Example Event Report:
https://play.dhis2.org/2.33.3/dhis-web-event-reports/index.html?id=R4wAb2yMLik
Change extension from “events/query/eBAyeGv0exc.html+css?” to “events/query/eBAyeGv0exc.csv?”