Removes history information on pages and their attachments based on space keys or the whole Confluence instance.

Parent
Type
Path
rest/historymgr/1/cleaner/remove-histories
Method
POST
Since
1.0

Removes history for all pages on the space with the given key.

The service starts a long running task that covers all accessible, current pages of the specified spaces. If no spaces are specified, the service will cover all spaces on the Confluence instance.

There are options to remove the history of pages as well as the history of the page attachments.

No Undo!

 

There is no undo!

It is strongly recommended to run commands only on backed up instances. Make a backup of your data before starting to work with this API! Consider to run your experiments on a copy of the production data!

Parameters

The service provides the following parameters to control the histories to be cleaned.

spaceKeys

The list of comma-separate keys for spaces to remove their history of pages (and their attachments). If not specified, all spaces are traversed.

keepCount

The number of page versions to keep, 1 (default) meaning that only the current version is kept.

Accepted values are larger than zero.

preservePattern

The pattern to match for version comments. Versions that match this pattern are preserver, that is: not removed.

Danger of loosing Versions!

 

Please note that any versions that do not match are removed. This includes versions whose comments are misspelled.

The preserve pattern is applied to all page versions that are taken into consideration. That is the versions saved with the keepCount are preserved whether they match this pattern or not.

 

Assume that important versions have a comment that starts with [important]. If you want to preserve this versions, use the following regular expression.

^\[important\].*$

Note that for this example versions with the following comments will be removed, since they do not match the example expression.

  • important: My very special version
  • [important - this is important!
  • important change

removeAttachments

Controls whether or not the attachments of versions that are not removed should also be cleaned.

If checked previous versions of attachments to pages are also removed.

attachmentKeepCount

The number of attachment versions to keep, 1 (default) meaning that only the current version is kept.

Response

The response on a successful call is 202 with a Location header information to find the started long running task.

 

A location value is a link to the REST service providing access to the long running task.

http://localhost:1990/confluence/rest/api/longtask/6e19ce1e-9671-4953-bd1d-a915a15b1a57

If a space key does not point to a space or a space is not accessible for the user starting the service, this space key is skipped.

The response returns a 500 on any internal error.