I have a number of dynamic macro add-ons for Confluence, that use AP.request
to fetch the macro body content via the Confluence REST API.
Recently this seems to have stopped working, and I was wondering if anyone knows if something changed in the REST API that might explain this?
Example code that was previously working, and now isn’t is:
AP.request('/rest/api/content/30509981/history/140/macro/id/102cd177-0549-4668-988a-4b2ba2590ae7')
.then(data => console.log(data))
.catch(e => console.log(e));
I don’t see anything logged in the browser console, and there are no requests in the Network tab to indicate that the REST API call is even being made?
I can confirm that the REST endpoint URL is correct, as I’m able to append it to my Confluence instance URL + context and paste it into the browser address bar, which returns the JSON as expected, e.g.
I can also use a plain fetch()
request with CORS from the host Confluence page’s context, and it too returns a successful 200 OK response with the JSON as expected:
fetch('/wiki/rest/api/content/30509981/history/140/macro/id/102cd177-0549-4668-988a-4b2ba2590ae7', {credentials: 'same-origin'})
.then(data => console.log(data));
The problem only seems to be occurring when using AP.request
to call the REST API from the add-on’s iframe context.