Well, i am working with a confluence macro and I use the pageId as the main argument.
When I try to run the macro in a older version page , I am getting the message “This content with this ID does not exist”. So I cannot run the macro to previous page versions.
The ‘history’ endpoint that was mentioned, it can work (while accessing older page versions) only if i had a way to know the pageId of the current page version .
I have a similar problem at the moment too: when the macro is viewed on a historical version, I get only the page id of the historical version but some of the content I want to access (attachments, custom content) are always stored under the id of the current version
It seems to be surprisingly hard (on Cloud) to go from the id of the historical version to the id of the latest version, as @mantadakise mentions all the APIs seem to go the other way: assume that you have the id of the current version and want to also see historical content
One hack that is working for me (at the moment):
the /wiki/rest/api/content/{id}/version endpoint gives a result also with an id of a historical version
Most of the other content/{id} endpoints just return 404 in that case
The content/{id}/version endpoint returns an array with a single entry when called with id of a historical version, and some of the links in that entry point to current version
I use results[0]._links.self and parse the current version id from it (the link has the format /wiki/rest/api/content/{current-version-id}/version/{version-number-of-the-historical-version}
Obviously this is not a very robust solution but better than nothing
Would appreciate comments if someone knows of a more stable way to get the info!