Hello. I see in the documentation that it's possible to copy resources using the POST method.
Here is what documentataion shows: http://<host>:<port>/jasperserver[-pro]/rest_v2/resources/path/to/folder?<arguments>
And there are arguments: "createFolders" and "overwrite".
But it's not clear how exactly I should pass source and destination. Can anybody show the example, please? For example, if I want to copy file1 from folder1 to folder2
1 Answer:
example written in bash to copy sample report to the "temp" directory:
copy_resp=$(curl -k -X POST "http://localhost:8080/jasperserver-pro/rest_v2/resources/temp?j_username..." -H "Accept: application/json" -H "Content-Location: /public/Samples/Reports/01._Geographic_Results_by_Segment_Report")
if [[ $upload_resp == *"errorCode"* ]]; then
echo "Copy failed"
else
copy_uri=$(echo ${copy_resp} | jq -r '.uri')
echo "Copied report to: "$copy_uri
fi