Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,364,907
Community Members
 
Community Events
168
Community Groups

Confluence WIKI Tab/Tabs Macro Rest API

WK I'm New Here Aug 18, 2022
I'm trying to use api to update a page but this page requires tab/tabs.

I get how to MANUALLY add macro tab/tabs to the page, but how do i achieve this through api? I'm already using task macro so... i get <ac:task-list> blahblah but there is not much of help for tab/tabs. does anyone know how to do this? I even tried to manually add macro tab/tabs to a page and view source code to find how to add tab/tabs by code. but that didn't really help because it had macro-ids created already. (which is randomly created everytime i think)

I went on hours trying to figure this out but i couldn't..

this is as close as i got. but this won't show me tabs at all. 


<ac:structured-macro ac:name=\"ui-tabs\">
    <ac:structured-macro ac:name=\"ui-tab\">
        <ac:parameter ac:name=\"title\">First_Tab_Title</ac:parameter>
        <ac:rich-text-body><p>First tab page content test. is this happening.</p></ac:rich-text-body>
    </ac:structured-macro>
    <ac:structured-macro ac:name=\"ui-tab\">
        <ac:parameter ac:name=\"title\">Second_Tab_Title</ac:parameter>
        <ac:rich-text-body><p>22222222222222 is this happening.</p></ac:rich-text-body>
    </ac:structured-macro>
</ac:structured-macro>

I need help in inserting macro tab/tabs or some other way to add tab/tabs to confluence wiki through api.... please help....

so this is what i'm doing in steps.

  1. create empty wiki page
  2. upload files to the wiki page created in the step 1
  3. assemble html code to update wiki page created in the step 1
  4. update wiki page created from step 1

2 answers

1 accepted

0 votes
Answer accepted

Hi,

there needs to be an

<ac:rich-text-body>

within the outer ui-tabs-macro:

<ac:structured-macro ac:name="ui-tabs" ac:schema-version="1">
<ac:rich-text-body>
<ac:structured-macro ac:name="ui-tab" ac:schema-version="1">
<ac:parameter ac:name="title">Tab1</ac:parameter>
<ac:rich-text-body>
<p>Text 1</p>
</ac:rich-text-body>
</ac:structured-macro>
<ac:structured-macro ac:name="ui-tab" ac:schema-version="1">
<ac:parameter ac:name="title">Tab2</ac:parameter>
<ac:rich-text-body>
<p>Text 2</p>
</ac:rich-text-body>
</ac:structured-macro>
</ac:rich-text-body>
</ac:structured-macro>

 

Andi when you use the API you should put the whole storage format into one line (my experience). And you don't need the macro-id.

Greetings,

Volker

0 votes

Hi @Volker Weinreich Thanks for describing solutions using Rest API. 

For people who are less technical are available ready-to-use solutions for Tab macro from the marketplace.  One of them for example Content Formatting Macros for Confluence (created by my team)

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events