In order to run a report asynchronously, the v2/reportExecutions service provides a method to specify all the parameters needed to launch a report. Report parameters are all sent as a reportExecutionRequest object. The response from the server contains the request ID needed to track the execution until completion.
Method | URL | ||
POST | http://<host>:<port>/jasperserver[-pro]/rest_v2/reportExecutions | ||
Content-Type | Content | ||
application/xml application/json | A complete ReportExecutionRequest in either XML or JSON format. See the example and table below for an explanation of its properties. | ||
Return Value on Success | Typical Return Values on Failure | ||
200 OK – The content contains a ReportExecution descriptor. See below for an example | 403 Forbidden – When the logged-in user does not have permission to access the report in the request. 404 Not Found – When the report URI specified in the request does not exist. |
The following example shows the structure of the ReportExecutionRequest:
The following table describes the properties you can specify in the ReportExecutionRequest:
Property
Required or Default
Description
Required
Repository path (URI) of the report to run. For commercial editions with organizations, the URI is relative the the logged-in user’s organization.
Required
Specifies the desired output format: pdf, html, xls, xlsx, rtf, csv, xml, docx, odt, ods, jrprint.
As of JasperReports Server 6.0, it is also possible to specify json if your reports are designed for data export. For more information, see the JasperReports Library samples documentation.
false
When data snapshots are enabled, specifies whether the report should get fresh data by querying the data source or if false, use a previously saved data snapshot (if any). By default, if a saved data snapshot exists for the report it will be used when running the report.
false
When data snapshots are enabled, specifies whether the data snapshot for the report should be written or overwritten with the new data from this execution of the report.
true
In a commercial editions of the server where HighCharts are used in the report, this property determines whether the JavaScript necessary for interaction is generated and returned as an attachment when exporting to HTML. If false, the chart is generated as a non-interactive image file (also as an attachment).
true Affects HTML export only. If true, then inline scripts are allowed, otherwise no inline script is included in the HTML output.Optional
When set to true, the report is generated as a single long page. This can be used with HTML output to avoid pagination. When omitted, the ignorePagination property on the JRXML, if any, is used.
Optional
Specify a page range to generate a partial report. The format is <startPageNumber>-<endPageNumber>
false
Determines whether reportExecution is synchronous or asynchronous. When set to true, the response is sent immediately and the client must poll the report status and later download the result when ready. By default, this property is false and the operation will wait until the report execution is complete, forcing the client to wait as well, but allowing the client to download the report immediately after the response.
Optional
Advanced property used when requesting a report as a JasperPrint object. This property can specify a JasperReports Library generic print element transformers of class net.sf.jasperreports.engine.export. GenericElementTransformer. These transformers are pluggable as JasperReports. extensions
attachments
For HTML output, this property specifies the URL path to use fo downloading the attachment files (JavaScript and images). The full path of the default value is:
{contextPath}/rest_v2/reportExecutions/{reportExecutionId}/exports/{exportExecutionId}/attachments/
You can specify a different URL path using the placeholders {contextPath}, {reportExecutionId} and {exportExecutionId}.
baseURL[/code]String Specifies the base URL that the report will use to load static resources such as JavaScript files. You can also set the deploy.base.url property in the WEB-INF/js.config.properties file to set this value permanently. If both are set, the baseUrl parameter in this request takes precedence.
A list of input control parameters and their values.
When successful, the reply from the server contains the reportExecution descriptor. This descriptor contains the request ID and status needed in order for the client to request the output. There are two statuses, one for the report execution itself, and one for the chosen output format. The following descriptor shows that the report is still executing (<status>execution</status>).
The value of the async property in the request determines whether or not the report output is available when the response is received. Your client should implement either synchronous or asynchronous processing of the response depending on the value you set for the async property.
Recommended Comments
There are no comments to display.