Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to transfer an attachment from one page to another using REST API with cURL?

Coline Macorol October 30, 2020

Hello!

I've been working on curl/php curl code to transfer an attachment on a page to another page using the PUT method with the REST API. I've been stuck on this for awhile, so any help would be greatly appreciated! 

 

Here's my curl code:

curl -D- -u username:pwd -X PUT -H 'Content-Type: application/json' -d '{"id":"1212121","version":{"number":1},"properties":{"space":{"key":"TST"}},"definitions":{"container":{"id":"0000000","status":"current","title":"Transferred to This Page"}}}' http://mylocalhosturl:8090/rest/api/content/1111111/child/attachment/2222222

In previous testing, I only had the id, version, and new container parameters but it gave me a 500 error. The code above gave me a 200 response, but the attachment remained on the same page. Any ideas why it is giving me a success message, but not actually doing what I want it to do?

I also have a php version of the code above, but obviously that doesn't work since there is something off with the curl code. I have made it work with updating the title and comments of the attachment using curl and php curl with the PUT method, so I'm not sure why updating the parent container of the attachment in order to move it to another page is not working.   

 

0 answers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events