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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


Code Macro via Confluence REST API

Hello, I want to send a codeblock macro via REST API. I am using Pythons Confluence library and this code snippet: 
<ac:structured-macro ac:name="code">
    <ac:parameter ac:name="title"></ac:parameter>
    def authenticate():
      confluence = Confluence(
      return confluence
Neither plain-text-body nor rich-text-body are recognized by Confluence. The result is an empty codeblock.
My question therefore: How can I add text to the codeblock in this structure?

1 answer

1 accepted

0 votes
Answer accepted
Dominic Lagger
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.
Aug 03, 2022

Hi @Zu Jiry 

Can you try with: 

<ac:structured-macro ac:name="code">
<![CDATA[def authenticate(): confluence = Confluence( url='', username=os.environ['CONFLUENCE_USER'], password=os.environ['CONFLUENCE_API_TOKEN'], cloud=False ) return confluence

Let me know if this worked.

Regards, Dominic 

Thank you! Works like a charm

@Zu Jiry @Dominic Lagger  How does one know a specific "code" of ac:macro/macro ID ?

Or where should i get them in confluence ?

@Pres Hi.

So, the workaround I used is to use the macro in confluence where you can just implement it normally. Then look at the page source code (HTML) of it.

Be mindful, that you might not need to implement every parameter yourself found in the HTML code. There are some, that confluence automatically adds, but you will have to figure out which ones...

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events