Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

82 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you