jeanpierrepolnareff91 Posted December 6, 2019 Share Posted December 6, 2019 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. Link to comment Share on other sites More sharing options...
Solution arnaudsimon091 Posted December 11, 2019 Solution Share Posted December 11, 2019 Hi jean-pierre !You can publish reports with the REST API, go to this documentation (https://community.jaspersoft.com/wiki/how-use-rest-v2-upload-report-unit-jasperreports-server-base64-encode-approach) for more information.Example of a shell script right here : #put all the jrxml into a variableJRXML_DATA_1=$(cat ../select_acti.jrxml) #curl command to publish the jrxml filecurl -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 reportUnitcurl -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"?><reportUnit> <description></description> <label>select_acti</label> <permissionMask>1</permissionMask> <uri>/path/select_acti</uri> <version>0</version> <dataSourceReference> <uri>/datasource_path</uri> </dataSourceReference> <alwaysPromptControls>true</alwaysPromptControls> <controlsLayout>popupScreen</controlsLayout> <inputControlRenderingView></inputControlRenderingView> <jrxmlFileReference> <uri>/path/select_acti_jrxml</uri> </jrxmlFileReference></reportUnit>Best regards,Arnaud Link to comment Share on other sites More sharing options...
Recommended Posts
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