on 02-08-2016 11:48 PM
I must be missing something. For charts in Webi Reports, I can't understand why exporting a Webi Report to HTML would generate a link back to the server with a ticking time bomb logon token attached for the chart URL? Is there some way to have the HTML export contain static normal images of charts, like jpeg or png?
hi Craig,
The reason is: as you ask for "text/html", only the HTML part may be returned. And thus the only way to provide the images is through links.
However, may I suggest you export the report, accepting "application/zip" ?
Regards,
eric
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From Powershell:
$RequestUri = $environment + "/biprws/raylight/v1/documents/" + $DocID + "/reports/1"
#$RequestHeaders = @{"Accept" = "text/html";"Content-Type" = "application/json";"X-SAP-LogonToken" = $LogonToken}
$RequestHeaders = @{"Accept" = "application/zip";"Content-Type" = "application/json";"X-SAP-LogonToken" = $LogonToken}
$HTML = Invoke-RestMethod -Method GET -Uri $RequestUri -Headers $RequestHeaders
$HTML | Out-File ("d:/temp/report.zip")
Thanks for all the quick responses on this forum!
2 things needed to be done.
1. Specify charset (encoding) as Dan mentioned. The correct syntax for doing that is below.
2. Avoid use of Powershell variable. It turns out Powershell is trying to parse the results if the result of the rest call is stored in a variable, and it corrupts the result. To avoid this, you take the result of the REST call directly to a file with an -OutFile parameter
$RequestHeaders = @{"Accept" = "application/zip;charset=utf-8";"Content-Type" = "application/json";"X-SAP-LogonToken" = $LogonToken}
Invoke-RestMethod -Method GET -Uri $RequestUri -Headers $RequestHeaders -OutFile "d:/temp/report.zip"
So it works great! Thanks Eric and Dan!
There are even some Powershell methods to extract the zip file if need be. I may also implement that. If so, I'll update this post with my code.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.