REST API: get spacekey/ID by page ID

I like to configure a redirect for two confluence spaces we have migrated to another instance, so users which use an old link will be redirected two the new instance. The problem is for confluence pages which use Page ID URLs instead of friendly name URL, e.g. https://xxx.atlassian.net/wiki/pages/viewpage.action?pageId=57686360

So I need a way to identify pages from the two migrated spaces, but I can’t find a way to get the spacekey or space ID by page ID. At least, I don’t find any method in the REST API documentation.

Is there really no way?

Hi Winston,

You could use the REST endpoint GET /wiki/rest/api/content/{id}
https://developer.atlassian.com/cloud/confluence/rest/#api-content-id-get

One of the elements that is returned in the response is the space key.

Oh, actually before I posted the question I even successfully tested this using the content method with a content ID I found in the database, but I didn’t realize contentID is the same as PageID. So I was looking for a REST method which use the page ID as input Parameter.

Thank you very much
Winston