Requirement
One of our users has a task of importing a separate organization via REST v2 API on a regular basis. The correct syntax for this task is not outlined clearly in our current documentation and took some effort and consulting with our engineering to make it work.
Solution
The steps below were performed using Postman plugin for Chrome browser. The general workflow is as follows:
1. Export organization to zip outputfile. Make sure to export specifically organization (meaning use --organization flag in command line, or alternatives for it in web interface or REST API)
2. Import using the RESTv2 API call in Postman
The URL used is:
POST http://<host>:<port>/jasperserver-pro/rest_v2/import?j_username=superuser&j_password=superuser&organization=myOrg&mergeOrganization=true&brokenDependencies=skip
The headers are :
Content-Disposition:form-data; name="file"; filename="222_export.zip" Content-Type:application/zip X-Remote-Domain:true
Note the X-Remote-Domain header. It is required to bypass the CSRF protection on the server. An alternative would be to disable the CSRF protection on TIBCO JasperReports® Server altogether.
Also make sure to add to add the zip file as binary to the request body.
Also attached is a screenshot of the request from Postman:
Recommended Comments
There are no comments to display.