How to pass JSON data as @RequestBody from Spring

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.

mchisty's picture
97
Joined: Sep 13 2007 - 12:45pm
Last seen: 1 week 3 days ago

0 Answers:

No answers yet
Feedback
randomness