Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

Using REST API & Curl, how do I delete a confluence history version?

Hi,

We're running Confluence 7.11.  I have a page that has over 5000 versions in the page history.  Obviously, deleting each page version 1 by 1 by point and click is a non-starter.  Google is not showing any workable answers.  What is the right way/url to delete a specific page history version using the REST API?  

I've tried the following URL approaches and none have been successful:

  • mysiteblah/rest/api/content/${incontentid}/version/1  -> ERROR
  • mysiteblah/rest/api/content/${incontentid}/1 -> ERROR
  • mysiteblah/rest/api/content/${incontentid}?version=1 -> Deletes whole page
  • mysiteblah/rest/experimental/content/${incontentid}/1 -> ERROR
  • mysiteblah/wiki/rest/api/content/${incontentid}/2 -> ERROR

 

Thank you!

2 answers

1 accepted

0 votes
Answer accepted

It's been a long time but I finally figured part of this out.  I ended up re-writing my purge prior history program in Python3.  With the use of the Atlassian Confluence API, it provides a method for deleting prior versions.  ie: 

confluenceinst.remove_content_history(title_pageid, version_number)

Even though this isn't a shell/curl solution, it works well.  If you're curious, the REST API URL it uses inside the Atlassian library is of the form:

"rest/experimental/content/{id}/version/{versionNumber}"
Kishan Sharma Community Leader Oct 01, 2021

That's great Rick, thank you for sharing the solution here :)

0 votes
Kishan Sharma Community Leader Aug 07, 2021

Hi, Can you try the answer provided in this thread and see if that works for you ?

It doesn't work for me.  I get this error: 

"HTTP Status 405 – Method Not Allowed

The method received in the request-line is known by the origin server but not supported by the target resource."

The url I used was: https://confluenceblah.blah/wiki/rest/api/content/1048446960/version/2

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

🏠 Say hello to the new Confluence Home!

Hi Atlassian Community, My name is DJ Chung, and I’m a Product Manager on the Confluence Cloud team. Today, I’m excited to share a new and improved version of Home. The new Home helps you ...

40,299 views 28 129
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