Report with JSON DataSource as a parametr

Hi, I have a question,

I would like to generate report with Data Source added as a JSON file in POST request and I'm little confused.

1) I see in JasperStudio that I can choose JSON File Adapter via URL, but as I understand I will have to create sth like web service / server where I will have to collect json files and my data source will GET the JSON every time I will run report

2) I see in documentation that I can call report asynchronously and add json content but as I understand that is just some kind of "request definition"

So my question is:
Is it possible to send easy JSON to jasperserver as a part of post request and receive for example PDF file from jasper. Probably I'll have to create special application for example website where I will have to create form with button and post javascript function which will create request but I'm not sure how the report will know that in my post is my dataSource - needed to fill the report

any help where to find the answer?

eidt: or maybe I have to keep json file in some server, then run report as I wrote above and there is no other option.

przemyslaw.pytlak's picture
Joined: Nov 26 2015 - 1:00am
Last seen: 5 years 1 month ago

1 Answer:

You just have to create a simple servlet. If you POST, just use getReader() to get the body. You'll need to use JasperReports Java library to create a report (you won't need REST API). This should only require few lines of codes to do.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 9 months ago