Requirement:
The customer would like to know how to export specif number of pages via REST API. It can be embedded in the client application to retrieve the specific report pages according to the user seclection.
Solution:
Here are the steps you should follow to export specif number of pages. I'm using sample AllAccounts report logged in as superuser.
Generate report in HTML and find out how many pages does it consist of:
POST http://localhost:8080/jasperserver-pro-51/rest_v2/reportExecutions
<reportExecutionRequest> <reportUnitUri>/organizations/organization_1/reports/samples/AllAccounts</reportUnitUri> <async>false</async> <interactive>true</interactive> <outputFormat>html</outputFormat> <ignorePagination>false</ignorePagination> </reportExecutionRequest>
Download first ten pages of the report:
GET http://localhost:8080/jasperserver-pro-51/rest_v2/reportExecutions/674823446_1378715298797_2/exports/html;pages=1-10/outputResource
If you want to export another pages in next request just change URL accordingly (e.g. page 20):
GET http://localhost:8080/jasperserver-pro-51/rest_v2/reportExecutions/674823446_1378715298797_2/exports/html;pages=20/outputResource
Recommended Comments