If I render a page with a Macro in it, that element has a localId. If that component is rendered by my function, the context I get from useProductContext()
which contains the actual configuration (context.extensionContext.config
)
Is there a way I can get that info without rendering the page, e.g. when I’m rendering another page? That would be nice/clean/efficient because otherwise I need to move that data around by storage.set/get
Hi @GerbenWierda,
You can get some context information such as macro localId
through the REST API. For example, if you call GET /wiki/rest/api/content/{id} and expand body.storage
(https://yoursite.atlassian.net/wiki/rest/api/content/8888888?expand=body.storage), you will see macro’s in the body with their local IDs. However, it might be more viable to use your storage based solution instead because that might allow you to associate other meta data necessary necessary for your app.
Regards,
Dugald
Yes, I’m looking into the ‘pure’ storage solution. Good to know this though, thanks.
My storage solution was coming along great until suddenly my async events (which I used in combination) stopped working (see other question with a real minimum example)
1 Like
@dmorrow Is it correct that there is no v2 api for this? The v1 api doc says it is deprecated, but could not find a v2 api way to do this. (I need this api call still to get my data to storage, because I need to update storage when a page is updated (published).
const res = await api
.asApp()
.requestConfluence(route`/wiki/api/v2/pages/${pageId}?body-format=atlas_doc_format`, {
headers: {
'Accept': 'application/json'
}
});
When I use ?body-format=atlas_doc_format
I get json, but not quite because everything in body is escaped so for instance stringify
doesn’t work. If I use ?body-format=storage
the body is presented as XML. Is there a way to get json?