API possible to download EventReports .csv

Hello - I had posted on the Development channel, but this is a Support question related to API

(previous Q Is there a list of what all the API calls are? SOLVED: instanceURL/api (easy!)

Q We’re trying to use PowerBi-DHIS2 connection instructions, using this will allow pivot table download: dhis2-instance.org/api/reportTables/UID/data.csv

We have tried /eventreports/ or /eventreport in place of ‘reporttables’, but the .CSV isn’t downloading (just an Error message).

Is this an available feature, to download .csv of eventreports from the API?

Thank you,
Sara

2 Likes

See above.

2 Likes

@sgaudon Did you mean the report in Event Report app ? In the app, you can download the report in CSV format, and the api for downloading can be taken from browser console in network tab. Below is an example

api/29/analytics/events/aggregate/IpHINAT79UW.csv?dimension=ou:ImspTQPwCqd&dimension=pe:LAST_12_MONTHS&dimension=wQLfBvPrXqq&stage=A03MvHHogjR&displayProperty=SHORTNAME&tableLayout=true&columns=ou;pe&rows=wQLfBvPrXqq

2 Likes

Hi Viet!

Ultimately, we want to send the data from an Event Report to PowerBi. We are trying the instructions from this post Linking Power BI and DHIS2

However using ‘eventreport(s)’ in place of ‘reporttables’ isn’t working (with /data.csv at end, we aren’t able to get the download. This works fine for pivot tables, using ‘reporttables’).

Again, we’re trying those instructions that used pivot tables, so my main question is, will this work with eventreports?

(I have also contacted FHI360 and BAO to ask; wondering if the reason BAO is making the connector, because of challenges using event/tracker through API?)

Thanks again,
Sara

1 Like

@sgaudon From what I see in the source code, the api endpoint /eventReports doesn’t support data format extension {uid}/data.csv as in /reportTables.

A work around is to use the /analytics/events api as mentioned above

https://jira.dhis2.org/browse/DHIS2-603

1 Like

Hi @sgaudon,

Did you get how to send the data from and Event report to PowerBI? Can you help? I need it too?

Best,
Lcaynar

1 Like