I need to programmatically copy content from Confluence Cloud pages to an external system. I do that by getting the storage format of pages and converting that to something the external system can understand.
Now, part of the Confluence Cloud pages are data cards. Those are represented as simple <a>
links in the storage format, with some metadata.
I need the content of those data cards, not just the link.
Take the Jira issue list data card as example. In storage format this looks like the following::
<a href="https://contoso.atlassian.net/issues/?filter=10002" data-layout="wide"
data-card-appearance="block"
data-datasource="{"id":"97a67335-59ec-4fd8-b356-97f4f2e0ae55",<snip>}">
https://contoso.atlassian.net/issues/?filter=10002
</a>
When rendering the page in the browser, Confluence will look up the actual data for that card using the following endpoint:
gateway/api/object-resolver/datasource/97a67335-59ec-4fd8-b356-97f4f2e0ae55/fetch/data
This will return the data card content, in this case the issues to display for the linked Jira filter.
I need that data.
Is there a way to get this data from any endpoint, ideally in a supported way? Via REST API, using a script or console app that runs externally?
The object-resolver endpoint above requires the tenant.session.token cookie to be sent along, which contains a JWT token that is issued by the session-service for the atlassian audience.
I already tried sending along a JWT token generated for an OAuth 2 app I registered, but that returns an error. No success either with basic auth.
But maybe somehow manually grabbing the tenant.session.token is the way. At least there are scripts out there where Atlassian advises to do such things as copying cookie values.
Any hints are appreciated.