Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Confluence WIKI Tab/Tabs Macro Rest API

WK August 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
Volker Weinreich August 19, 2022

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
Zoriana Bogutska_Adaptavist_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
September 30, 2022

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
AUG Leaders

Atlassian Community Events