URLs
GET /api/v1/report/{TemplateID}/export
GET /api/v1/report/{TemplateID}/export/{ExportProfileID}
If the ExportProfileID is not specified, the default profile of the report template will be used.
Optional parameters
Parameter can be passed in URL as ?param=value or form-encoded in the request body.
Name |
Values |
Default |
Function |
resulttype |
firstpage/ pagelinks |
firstpage |
If value is "firstpage", the first exported file is returned directly. Additional files will be ignored. If value is "pagelinks", an object of type "ExportResult" (see below) will be returned serialized as JSON or XML which contains the paths of all created files. |
format |
json/ xml |
json |
Sets the format with which the ExportResult object will be serialized if the result type "pagelinks" is shown. |
$parameter |
String(s) |
- |
All URL parameters that begin with $ will be passed on to the export as report parameters. $param=value assigns the report parameter @param with the value "value". All report parameters must be url-encoded. Date values should be in an ISO 8601 format without time zone e.g. 2015-04-28T04:07:02 Report parameters that have multiple values must be separated by semicolon e.g. $ categories =1;2 |
nocache |
true/ false |
false |
If value is "true", an export will always be triggered instead of using the cache |
zip |
true/ false |
false |
If value is "true", all exported files will be zipped and the archive returned |
Result
The request will run until the report has been created (Code 200) or an error has occurred.
▪ If resulttype=firstpage:
The first created file will be returned; hence for several JPGs only the first will be returned. In the response, the Content-Type header will be set to the MIME type of the file created. If the zip option has been chosen, then the zip archive will be returned with all the files created.
▪ If resulttype=pagelinks
An ExportResult object will be returned (see below) which contains the URLs of all files created. These should be accessed within a few minutes (< 5), or the RS may already have removed them by then.
Error codes (in addition to general error codes)
Status code |
Status text |
Explanation |
500 |
- |
Error during export. A localized error message is located in the request body. |
404 |
ERR_INVALID_TEMPLATE |
Report template not found. |
404 |
ERR_INVALID_EXPORTPROFILE |
Export profile not found. |
403 |
ERR_ACCESS_DENIED |
No access rights for report template / export profile. |
410 |
GONE |
May occur if resulttype=pagelinks. The requested file has already been removed by the RS because it was not accessed in time. |
Return type: ExportResult
This is returned (as XML or JSON) if a report with several files is requested (and the resulttype parameter was "pagelinks")
▪ FileUrls: is a string array with absolute URLs to the created files. These are only accessible for a short time and will be deleted afterwards! Should the file no longer be available, then the server will return 410 GONE
▪ ExpiresOnUTC: is a date formatted according to ISO-8601 (UTC-Time), as of which the report will no longer be valid (corresponds to internal cache time of RS, but NOT the time at which the files will be deleted.
▪ IsFromCache: is true if the report is delivered from the RS cache and has not been re-exported.
▪ RelativeFilePaths: is a string array that contains the relative filenames of the files in FileUrls (relative to the file that contains the first page of the report). Example: 'images/page1/chart2.jpg'. The order of the two arrays is the same so that the relative path in RelativeFilePaths [i] belongs to the file that can be downloaded under FileUrls [i].
▪ FirstPageFilePath: contains the relative path of the file (usually a simple filename) that contains the first page of the report. Example for HTML export: 'index.html'.
As XML
<?xml version="1.0" encoding="utf-16"?>
<ExportResult xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ReportName>delayed test</ReportName>
<IsFromCache>true</IsFromCache>
<FileUrls>
<string>http://<servername>/rs29/api/v1/report/2551186E-F854-4D1A-ACAE-8ABA02241AE2/tempresult/Rjg3ODZGMUQtQ0Y0RC00QjlELTlFQjUtQTAxRUQ3Mzc1QTRFL3Jlc3VsdC56aXA/result</string>
</FileUrls>
<ExpiresOnUTC>2015-04-13T21:34:52</ExpiresOnUTC>
</ExportResult>
As JSON
{
"ReportName": "delayed test",
"IsFromCache": true,
"FileUrls": [
"http://<servername>/rs29/api/v1/report/2551186E-F854-4D1A-ACAE-8ABA02241AE2/tempresult/Rjg3ODZGMUQtQ0Y0RC00QjlELTlFQjUtQTAxRUQ3Mzc1QTRFL3Jlc3VsdC56aXA/result"
],
"ExpiresOnUTC": "2015-04-13T21:34:52"
}