cancel
Showing results for 
Search instead for 
Did you mean: 

Use RESTFUL call to export webi report to CSV

Former Member
0 Kudos

Hi

I have a Powershell script that connects to BO server to export webi report to PDF and Excel file, the export for both are successful. What is the mime type to use to export the report to CSV? I tried using "text/CSV" but that caused error

Here is the code snippet

$headers = @{ "X-SAP-LogonToken" = $logonToken ;
             "Accept"      = "text/csv" ;
             "X-SAP-PVL"   = $contentLocale
             }

Invoke-webrequest -Method Get -Uri $documentUrl -Headers $headers -OutFile $rptfile

Here is the runtime error message

Invoke-webrequest : RWS 00058 Not acceptable, (RWS 00058)

At C:\temp\abc.ps1:118 char:5

+     Invoke-webrequest -Method Get -Uri $documentUrl -Headers $headers -OutFile $ ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException

    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

daniel_paulsen
Active Contributor
0 Kudos

Hi Freddie,

Are you trying to export the whole document or an individual report within the document..

text/csv is the correct mime-type, but you cannot export the whole document to CSV, you must export an individual report.  (.../documents/<docId>/reports/<reportId> )

Dan

Former Member
0 Kudos

Dan

Thanks for your reply.

When I used "biprws/raylight/v1/documents/{Rpt ID}", I was able to export as xlsx.

When I used "biprws/raylight/v1/documents/{Rpt ID}/pages", I was able to export as pdf

But it would not work with "text/csv" mime type.

Any idea?

On another note, do you know the URL to download the BO Restful service API reference guide? I had a PDF that documents how to export, get document, ID, parameter filters etc, but can't find it anymore.

daniel_paulsen
Active Contributor
0 Kudos

The URL you are using is for exporting the whole document, which supports export to PDF and XLSX, but not CSV.

To export to CSV, you need to export individual reports (tabs within the document) so if the first report tab has an ID of 1, then you can export it with:

"biprws/raylight/v1/documents/{Rpt ID}/reports/1"


You'll see in the documentation that exporting a document (full webi doc with all reports) does not have CSV as an export format.   Exporting reports (tabs within the document) does support CSV.


The documentation can be found at:  SAP BusinessObjects Business Intelligence platform 4.1 – SAP Help Portal Page


Dan

Former Member
0 Kudos

Dan

"biprws/raylight/v1/documents/{Rpt ID}/reports/1" works.


Thanks a lot for all your help.

Answers (0)