Confluence 5.7 REST API get content get many versions

Hi, there.

I’m working with an older version of Confluence and I’m trying to use the REST API to access the full version list for a given page. I am able to call out to /content/:id and get a the "version" object representing the most recent version, but when I call out to /content/:id/version I get a 404 (I’m assuming this isn’t available in this older version of Confluence).

Basically I’m looking for the API equivalent of the content found on /confluence/pages/viewpreviousversions.action?pageId=:id

Can anyone help me figure out how to use this older version of the REST API to access version history for a given page? Thanks so much in advance.

Michael

Hello @mlp.brooklyn,

Here’s one way on making it work with v5.7 (that I’ve successfully tried), but it’s going to take a number of calls as no one call can return the information you need:

  1. Get the latest content by page id via and expand the previous version /rest/api/content/:id?expand=history.previousVersion
  2. Get the previous page by adding the version number gathered from the previous step’s response, then adding the status as historical via /rest/api/content/:id?status=historical&version=:number&expand=history.previousVersion
  3. Repeat step number 2 as you decrease the version number until you reach the previous number of 1.

You can also try the REST APIs by using Confluence Server’s REST API Browser (General Configuration > REST API Browser).

Hope this helps.
Ian