Is it possible to publish a japser report (JRXML file) with command line prompt ?

Hello everybody !

I was wondering if it was possible to publish a report to the JasperReports Server with the command line, it could be very usefull to me !

Thanks in advance for helping.

jeanpierrepolnareff91's picture
Joined: May 22 2019 - 1:10am
Last seen: 4 months 5 days ago

1 Answer:

Hi jean-pierre !

You can publish reports with the REST API,  go to this documentation ( for more information.

Example of a shell script right here : 

#put all the jrxml into a variable

JRXML_DATA_1=$(cat ../select_acti.jrxml) 

#curl command to publish the jrxml file

curl  -X POST http://your_server:8080/jasperserver-pro/rest_v2/resources/path_where_you_want_to_put_the_report -H "Content-Type:application/jrxml" -H "Content-Disposition:attachment; filename=name_of_the_jrxml_file" -H "Content-Description:your description" -d "$JRXML_DATA_1" --user username:password

#load a reportUnit into a variable :

RESOURCEDESCRIPTOR_XML_1=$(cat ../select_acti_reportUnit.xml)

#curl command to create the reportUnit

curl -X POST http://your_server:8080/jasperserver-pro/rest_v2/resources/path -H "Content-Type:application/repository.reportUnit+xml" -d "$RESOURCEDESCRIPTOR_XML_1" --user username:password


example of reportUnit file : 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

Best regards,


arnaudsimon091's picture
Joined: Nov 26 2018 - 12:25pm
Last seen: 1 month 8 hours ago