Skip to Content
Sep 04, 2019 at 09:08 AM

Download a scheduled Webi report instance using the RESTful web services API


[BO 4.2 SP7 RESTful web services]


I'm currently replacing a piece of Java code in an application that scheduled a Webi report and downloaded the created instance (PDF or Excel) using the Java SDK. The goal is to remove all the Java SDK dependencies and rebuild the complete workflow using the RESTful web services only. So far I successfully achieved the following:

1. Logon to the BO Server using /logon/long
2. GET the needed report parameters using /documents/<documentID>/parameters?lovInfo=false
3. Schedule the report for "now" execution with filled paramters by POSTing to /documents/<documentID>/schedules
4. POST a query for the created instance ID by using /v1/cmsquery. (The query looks for the SI_NEW_JOB_ID attribute of the report document.)
5. GET the schedule status from /documents/<documentID>/schedules/<scheduleID> to check for it's completion.

All works fine up to this point. I can see the newly created instance in the History list of the report in the BO web frontend and also open/download the Excel or PDF file here.
The final step in the Java SDK application was to download the binary instance file for local storage on the client's machine. I did this with the following solution:

1. Get the instance IInfoObject from the IInfoStore by doing a query like in step 4 above.
2. Get an IFiles list by calling IInfoObject.getFiles().
3. Take the first entry from that list and cast it to an IRemoteFile instance.
4. Get a binary download stream of type IStreamingDownloadFile by calling IRemoteFile.getStreamingDownloadFile(0)

This stream allowed me to download the said binary file to the machine running the application. Unfortunately until now I did not succeed in replacing this solution with the RESTful web servcies API. I thought it should work with

GET /infostore/folder/<SI_ID of instance>/file

but in fact this seems to work only for files that I uploaded myself using POST /infostore/folder/<folder_id>/file. Report instances created by scheduling a report are not a "file" in a "folder" that can be accessed that way. When I try this, I receive an "Internal server error (RWS 00070)".

I also tried to get hold of the file by using the instance's OpenDocument link, but this points to a HTML page with Javascript code, only capable for using it is a browser, not for a low level binary download.

Am I missing something? How can I do the download of the instance file using the RESTful web services only? Or is this still not possible in BO 4.2 SP7?

Best regards,