How do I add the attachments macro programmatically in python?

Deleted user August 15, 2022

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

1 vote
Answer accepted
Deleted user August 15, 2022

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

Atlassian Community Events