How to return excel-reports/run response after the status is ready?
-
Is it possible to have mango automation server return the GET message for excel-reports/run only after its status is ready aka. the report is done? I need to chain excel-reports/run with /view and it would be of tremendous help if I could assure that the report is there when the code executes.
-
Hi Nyoa,
It is unlikely we would modify it to wait until the report finished to respond to the run, but the tools do exist to perform this logic!
The response to excel-reports/run is a JSON object about the report instance that has been created. Included in that object is its ID. You can use the ID to query the excel-reports/{ID} endpoint, which will return a JSON object with a "state" attribute, which will be set to "FINISHED" if the report is finished.
-
There is also a web socket endpoint that you can register at to receive notifications for all events to a given database table. The 2 for excel reports are:
/rest/v1/websocket/excel-reports /rest/v1/websocket/excel-report-templates
Check the code in the excelReports.js file as to how these endpoints can be used. We use it to update the run reports table on the second tab after a report finishes.