Hi,
I have a automation which publish 10s of pages on confluence everyday. Right now i am checking page existence, if page exists delete it and create it again with new content.
Instead of delete -> create , I am thinking to update if page exists. I think update will work all fine but issue I have is as i have 10s of pages and if i update the page it will have versions with every page and eventually after a month, i will end up 1000s of revisions.
So solution i was looking here is update the page and delete the version (latest -2), this way i will always main 2 versions of page and will also not end up having 1000s of versions.
After doing some research i found below link which stats it is possible if we get pageID of version.
https://community.atlassian.com/t5/Answers-Developer-Questions/Confluence-REST-API-How-to-list-and-delete-old-versions-of-a/qaq-p/542714
But I could not find the pageID of version. For sample I am pasting my output data as below:
https:///wiki/rest/api/content/12345/version
{"results":[{"by":{"type":"known","accountId":"xx","accountType":"atlassian","email":"dxx","publicName":"x","profilePicture":{"path":"/wiki/aa-avatar/xx","width":48,"height":48,"isDefault":false},"displayName":"x","_expandable":{"operations":"","personalSpace":""},"_links":{"self":"https://x/wiki/rest/api/user?accountId=xxx"}},"when":"2020-03-27T04:41:41.331Z","friendlyWhen":"27 minutes ago","message":"","number":2,"minorEdit":false,"syncRev":"0.confluence$content$12345","syncRevSource":"synchrony-ack","confRev":"confluence$content$12345.7","_expandable":{"collaborators":"","content":"/rest/api/content/12345"},"_links":{"self":"https:///wiki/rest/api/content/12345/version/2"}},{"by":{"type":"known","accountId":"x","accountType":"atlassian","email":"xx","publicName":"x","profilePicture":{"path":"/wiki/aa-avatar/x","width":48,"height":48,"isDefault":false},"displayName":"DevOps Confluence","_expandable":{"operations":"","personalSpace":""},"_links":{"self":"https:///wiki/rest/api/user?accountId=xx"}},"when":"2020-03-27T04:24:51.404Z","friendlyWhen":"44 minutes ago","message":"","number":1,"minorEdit":false,"syncRev":"0.confluence$content$12345","syncRevSource":"synchrony-ack","confRev":"confluence$content$123456.3","_expandable":{"collaborators":"","content":"/rest/api/content/12345?status=historical&version=1"},"_links":{"self":"https:///wiki/rest/api/content/12345/version/1"}}],"start":0,"limit":200,"size":2,"_links":{"base":"https:///wiki","context":"/wiki","self":"https:///wiki/rest/api/content/12345/version"}}This PageID 12345 has 2 versions. Now I could use
DELETE https://wiki/rest/api/content/12345/version/1 but i am getting 404
Regards
Sukh