Jump to content
We've recently updated our Privacy Statement, available here ×
  • How to import a separate organization via REST v2 API


    stasp
    • Features: Web Services Version: v6.3

    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:

    2016-08-2313_27_05-Postman.png.cf3c25e9f56cf58f9587f85053eda379.png

    2016-08-2313_27_05-Postman.png.c8e28def6ffcbc80df8d95c8c5cc614b.png


    User Feedback

    Recommended Comments

    There are no comments to display.



    Guest
    This is now closed for further comments

×
×
  • Create New...