In order to export the reports from jasperserver via a web service we need an API tool to connect to the Jasper server. We can use the ‘Postman’ API or freely available ‘Advanced rest client’ API.
Link to download Postman API : https://www.postman.com/downloads/
Link to download Advanced rest client API : https://install.advancedrestclient.com/install
Once these API tools are installed, then try to make a connection to JRS with these tools. Make sure that JasperReport server is up and running.
With get method from postman API try to send below request to server, if connection is successful then in response to below request server it return 200 OK code response with server information.
http://localhost:8080/jasperserver-pro/rest_v2/serverInfo
- Fetch the report using V2 report service.
Make a sample report available in the Jasper server to fetch it from the postman.
With the below v2/reports service URL, try to fetch the report from JRS.
Method : get
URL : http://localhost:8080/jasperserver-pro/rest_v2/reports/public/userrpt_15032022.pdf
–In the above URL use your reportname file which you want to access through API.
Report will be visible like below. You can export it from the postman API tool.
Steps to export Report using V2/export service
Here with V2/export we need to use the post method and use the URL below.
http://localhost:8080/jasperserver-pro/rest_v2/export/
It will ask for JRS credentials to connect to the server. Select basic authentication and put the JRS credentials.
Also under the body tab you need to provide a parameter value, in the below screenshot “everything” is provided. You can refer to the web-service cookbook from community jaspersoft to check for further parameter values.
So this will generate export_id, highlighted in blue in screenshot.
To check the above export status use the URL below with export_id.
Export_ID : deef7459-5f92-49f8-9571-684582e27f42
URL :
http://localhost:8080/jasperserver-pro/rest_v2/export/deef7459-5f92-49f8-9571-684582e27f42/state
It shows export status as successful in response.
To download the report :
Use the URL below with export_id to download the report.
Method : get
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now