Confluence API: How to get the content from previous version of a page?

776 Views Asked by At

I am implementing an add-on for Confluence. I need to retrieve the content from a previous version of a page. I managed it to get the content from the current version, but I can't get the previous versions content. I get only the history...

I get the content from the current version via: https://MYLINK/rest/api/content?spaceKey=MYSPACEKEY&title=MYTITEL&expand=space,body.view,version,container

How can I choose the Version here? If I write version=12, I get nothing, and if I write only 12 for example, I get again the latest version, and not the older one...

1

There are 1 best solutions below

0
On BEST ANSWER

I found the solution how to get the list of all versions and how to print the content out. The needed APIs are:

History / List of all versions for the specific page

https://LINK/rest/experimental/content/THEPAGEID/version?expand=content

Get content for a specific version of a page

https://LINK/rest/api/content/PAGEID?status=historical&version=PAGEVERSIONNUMBER&expand=space,body.view,version,container

Get content for the current version of a page

https://LINK/rest/api/content?spaceKey=~YOURSPACEKEY&title=TITELOFTHEPAGE&expand=space,body.view,version,container