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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Confluence WIKI Tab/Tabs Macro Rest API

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