Get macro output via REST API

Brad Glinkerman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 18, 2019

I have a confluence page that has a macro that runs an SQL query. The query outputs a table with the results when the page is rendered in a browser.

However, if I fetch: .../confluence/rest/api/content/128437000?expand=body.storage

It just returns the macro body (e.g., the SQL)--the macro is not executed.

How can I execute a macro via the API and get the macro output? Also, is there a way to get the output in json or csv instead of an HTML table?

Thanks in advance!

3 answers

1 vote
Markus Huber July 23, 2020

Hello,

same question, i use pocketquery and whant to get the result over rest.

 

i already tried :

/rest/content/{id}/history/{version}/macro/id/{macroId}

get the macroid over :
/rest/api/content/1481615325?expand=body.storage

get version as field number under lastupdated:
rest/api/content/1481615325/history

In my case i get a answer but the result is not in!

Sven Schatter _Lively Apps_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
July 23, 2020

While I wouldn't consider this an officially supported feature, you could probably use the "load dynamically" REST endpoint of PocketQuery to execute a Query. This however will also only give you the HTML.

We'd love to hear what your exact use case is! Could you maybe raise a ticket at our PocketQuery ServiceDesk and tell us more about it? (e.g. in what format would you expect the response, what users would need to use this endpoint, i.e. would it be okay if this was restricted to Confluence/PocketQuery admins, etc.)

Cheers,
Sven

Markus Huber July 23, 2020

Ok thanks, i will rise a ticket

0 votes
FURNARI SAMUELE
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 13, 2023

Hi, I have a similar issue but in my case the macro to Expand is a Page property summary. I resolved invoking the content endpoint and asking to it to expands the body.export_view.

eg: .../wiki/rest/api/content/138772481?status=draft&expand=body.export_view

It returns an html with the result of executed macro.

I hope this can help.

0 votes
Dirk Baumbach October 4, 2019

I don't have a solution, but i am also interested if there is any, because i have the same problem.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events