Jump to content
  • How to move folder resource with cURL


    stchan
    • Features: JasperReports Server Version: v7.2.0 Product: JasperReports® Server

    Issue Description

    How to move a folder with cURL command


    Resolution

    The resources Service provides methods to manipulate resources. Below example moves source folder from /organizations/organization_1/toBeMoved to /public/toBeMoved

    1) You can logon with plain password and perform the move

    curl -v -u superuser:superuser -X PUT "http://localhost:8080/jasperserver-pro/rest_v2/resources/public?
    createFolders=true&overwrite=false" -H "Content-Location:/organizations/organization_1/toBeMoved"

    2) Or you can create cookie and use it for subsequence commands  

    curl -v -c ./cookie.txt -X GET "http://localhost:8080/jasperserver-pro/rest_v2/j_spring_security_check?j_username=superuser&j_password=superuser"
    
    curl -v -b ./cookie.txt -X PUT "http://localhost:8080/jasperserver-pro/rest_v2/resources/public?createFolders=true&overwrite=false" -H "Content-Location:/organizations/organization_1/toBeMoved"

    Sample Output:

    * About to connect() to localhost port 8080 (#0)
    *   Trying 127.0.0.1...
    * Connected to localhost (127.0.0.1) port 8080 (#0)
    > PUT /jasperserver-pro/rest_v2/resources/public?createFolders=true&overwrite=false HTTP/1.1
    > User-Agent: curl/7.29.0
    > Host: localhost:8080
    > Accept: */*
    > Cookie: userLocale=en_US; JSESSIONID=4F2BF029CD1B958D7AAF9BE4F83B9AC0
    > Content-Location:/organizations/organization_1/toBeMoved
    >
    < HTTP/1.1 200
    < Cache-Control: private
    …
    < Content-Type: application/repository.folder+xml

     

     

     


    User Feedback

    Recommended Comments

    There are no comments to display.



    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 account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...