Jump to content
We've recently updated our Privacy Statement, available here ×

How to pass JSON data as @RequestBody from Spring


mchisty

Recommended Posts

Hi,

We are using SpringBoot for microservices solution. For reporting solution, we are in the process of migrating to JasperSoft latest version 8.1.x. We have a requirement as follows:

Step 1: A SpringBoot class/API (@RestController) should invoke a Jasper report API published in JasperServer by passing a list of DTO objects e.g. as a request body. The report URL may look like this http://localhost:8080/jasperserver/rest_v2/reports/LT/stimulus.pdf

Step 2: The expectation is that the PDF report should be generated based on the json data provided in request body

Questions:

Q1. Can you provide any example using which we can achieve the above?

Please note: Most of the examples online are not very useful; they are very basic and they mostly show about placing the .jrxml or .jasper file within the spring boot application. (screenshot  attached which is a bad example; very old style approach). And this is not what we are looking for. The jrxml/jasper template should only deployed in the jasper server and we want to produce the report by making a REST API call from Java/Spring and passing json data in request body or JRBeanCollection etc.

Q2. Is there any sample where we can test from Postman API by calling a jasper report by passing json input in request body?

Your feedback would be appreciable.

With Thanks.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...