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,369,394
Community Members
 
Community Events
168
Community Groups

How do I add the attachments macro programmatically in python?

I know that I can create a page with the following html template and get the "Children's Display" macro embedded.

'<p>Application {} Release Pipeline Logs</p><p><ac:structured-macro ac:name="children" ac:schema-version="1" /></p>'

What I can't find is the same HTML tag for embedding the Attachments macro on a page. 

I'm using the atlassian-python-api to add attachments to the page.

confluence.attach_file('{}.csv'.format(os.getenv('NAMESPACE')),
name='{}.csv'.format(os.getenv('NAMESPACE')),
page_id=new_product_tag_page_id,
title='{}'.format(os.getenv('NAMESPACE')), space=os.getenv('SPACE_KEY'),
comment='{} ContainerLogs'.format(os.getenv('NAMESPACE')))

And this code works, I know my attachments are getting uploaded, but I need to create this page_id with the attachments macro already enabled so that it just picks up the attachments. What is the HTML code that generates that macro?

1 answer

1 accepted

0 votes
Answer accepted

Turns out it was easy, just not documented anywhere that I can find.

 

product_tag_page_template = '<p>Application {} Build Pipeline Logs</p><p><ac:structured-macro ac:name="attachments" ac:schema-version="1" /></p>'

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS

Atlassian Community Events