Forums

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

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

Rick Lewis June 29, 2021

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
Rick Lewis October 1, 2021

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 Champion
October 1, 2021

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

0 votes
Kishan Sharma
Community Champion
August 7, 2021

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

Rick Lewis August 24, 2021

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
AUG Leaders

Atlassian Community Events