cancel
Showing results for 
Search instead for 
Did you mean: 

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

jrg_heinrich
Explorer
0 Kudos

[BO 4.2 SP7 RESTful web services]

Hello,

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,

Jörg

jrg_heinrich
Explorer
0 Kudos

Hello,

I have continued trying this, but I didn't find a solution until now. One remarkable thing I encountered is: When using the REST request

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

I changed the "Accept" property of the HTTP request to the MIME type that I derived from the

SI_MIME_TYPE property of the report instance, for example "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" for an Excel file. In this case the error I receive from the BO server is no longer "Internal server error (RWS 00070)", but it changes to

"Request cannot be processed; resource identified by the request is only capable of generating response entities which have content characteristics which is not acceptable according to the Accept headers sent in the request (RWS 00058)"

This sounds differently, just as if the instance resource does exist and can be accessed, but I'm using the wrong Accept property?!?

Maybe this is the problem, using a malformed HTTP request? Which are the Accept property values I need to use to download Excel, PDF or CSV files (generated instance from a scheduled WebI report)?

Thanks and best regards,

Jörg

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member230921
Active Contributor
ayman_salem
Active Contributor
0 Kudos
jrg_heinrich
Explorer
0 Kudos

Dear Ayman Salem,

thanks for you answer. Yes, I have checked these topics and they don't solve my problem. I'm able to query certain meta data of the report instance with this, but not download the generated file itself.

Best regards,

Jörg