Confluence Cloud Macro Parameters

Lee Parvin October 5, 2023

Hi there

Im learning creating Macros for Confluence Cloud, starting with the Hello World example under the Forge section.

Im now wanting to add parameters to the macro. I already have working REST API code that updates Confluence pages, and I now want to call my macro (with parameters) from within the REST API.

So for example, I have the Hello World macro on a page, which says 'Hello World'. I now want to update to the macro to display 'Hello Lee', ideally using the markdown syntax eg {LeeMacro:param1=Hello Lee{LeeMacro}

Is this possible?

1 answer

1 accepted

0 votes
Answer accepted
Bert van Dijk _TMC_nl_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2023

Hi @Lee Parvin ,

 

All options the macro gives you using the gui, can be used using the API. If you create a page with macros using the gui, then use the rest api to view/download the page, you will see how the options are included in the macro at the page.

Lee Parvin October 9, 2023

Hi Bert

Using the Pets Macro example, I have created the macro and added it to a Confluence Page, and it works well.   However, if I try to get the macro details using the REST API using (https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content---macro-body/#api-group-content---macro-body), I keep receiving the error Status 404 No Macro found on content ID..... 

The Macro ID I use was set in the Manifest.yml ie app id, and the Page ID is taken from the page that runs the macro.

Looking at the REST Response I get from calling ?expand=body.atlas_doc_format, it apprears that the Macro ID is different.

Thanks

Lee

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events