How to upload and udate/delete an existing attachement in a page - Confluence using Curl Command

Hi there,

 

I have a file which contains some information and it changes every week.

We would like to keep this file in a shared location(Confluence) so that users can get the updated information.

So we want to upload this new file each week and delete the existing one, since it is out datated.

1. So, How to delete the existing file and upload the new file to the space using REST API(CURL command)?

or

2. Can we update the content of the existing file using Rest api(CURL command)?

 

3. If so, what is the  curl command?

 

Thanks,

Jee

 

 

1 answer

0 vote
Stephen Deutsch Community Champion Jul 05, 2017

Here is an example from the official documentation:

https://developer.atlassian.com/confdev/confluence-server-rest-api/confluence-rest-api-examples#ConfluenceRESTAPIExamples-Uploadanattachment

When you upload an attachment with the same name, it creates a new version, which means the old version is accessible only by manually downloading an old version. Normal links should always point to the newest version.

If you want to delete the existing attachment instead, you will have to find the attachment ID (it should be returned when uploading) and use the same curl command as "Delete a page" in that same documentation.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

902 views 23 12
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you