atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

Display attached HTML content/file on confluence

Open alkTHG opened this issue 1 year ago • 1 comments

Using Atlassian Python API confluence.attach_content/confluence.attach file does not display the attachment.

For images the code below can be used as the append body to display an image f"""<ac:image> <ri:attachment ri:filename="{file_name}" /> </ac:image>"""

How can this be achieved if the content/file is html? Attachment is a preferred way to add content to a confluence page as updating the file updates the displayed content. Simple append results in unwanted duplication of displayed content. Thanks, Alan

alkTHG avatar Oct 26 '23 05:10 alkTHG

It is expected design of attach_content endpoint. You should use attach_content endpoint to upload multiple attachment to the page at once (this can save a lot of time).But then you need to place each attachment link to the page manually as it depends on structure of particular page

But as I understand you managed to 'inject f"""ac:image <ri:attachment ri:filename="{file_name}" /> </ac:image>""" lines into existing bodycontent of the page?

To attach external portion HTML code into confluence page I would use place it inside HTML macro (available on DC, I am not sure if there is an equivalent on cloud) https://community.atlassian.com/t5/Confluence-questions/How-do-I-add-HTML-to-a-page-on-Confluence/qaq-p/2285095 or iframe https://confluence.atlassian.com/confkb/how-to-put-an-iframe-into-confluence-598837531.html

gkowalc avatar Dec 12 '23 22:12 gkowalc