Running a Report

The v2/reports service allows clients to receive report output in a single request-response. The output format is specified in the URL as a file extension to the report URI.

Method

URL

GET

http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/
path/to/report.<format>?<arguments>

Argument

Type/Value

Description

<format>

output
type

One of the following formats: 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.

page?

Integer > 0

An integer value used to export a specific page

<inputControl>

String

Any input control that is defined for the report. Input controls that are multi-select may appear more than once. See examples below.

<span class="Code">interactive?
</span>

Boolean

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 when exporting to HTML. By default it is true. If set to false, the chart is generated as a non-interactive image file.

onePage
PerSheet?

Boolean

Valid only for the XLS format. When true, each page of the report is on a separate spreadsheet. When false or omitted, the entire report is on a single spreadsheet. If your reports are very long, set this argument to true, otherwise the report will not fit on a single spreadsheet and cause an error.

baseUrl 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.

Return Value on Success

Typical Return Values on Failure

200 OK – The content is the requested file.

404 Not Found – When the specified report URI is not found in the repository.

The follow examples show various combinations of formats, arguments, and input controls:

http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/reports/samples/AllAccounts.html (all pages)

http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/reports/samples/AllAccounts.html?page=43

http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/reports/samples/AllAccounts.pdf (all pages)

http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/reports/samples/AllAccounts.pdf?page=1

http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/reports/samples/EmployeeAccounts.html?EmployeeID=sarah_id

http://<host>:<port>/jasperserver[-pro]/rest_v2/reports/reports/samples/Cascading_multi_select_report.html?
Country_multi_select=USA&Cascading_state_multi_select=WA&Cascading_state_multi_select=CA

JasperReports Server does not support exporting Highcharts charts with background images to PDF, ODT, DOCX, or RTF formats. When exporting or downloading reports with Highcharts that have background images to these formats, the background image is removed from the chart. The data in the chart is not affected.

Feedback
randomness