atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.29k stars 643 forks source link

Display attached HTML content/file on confluence #1271

Open alkTHG opened 8 months ago

alkTHG commented 8 months ago

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>"""`

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

gkowalc commented 6 months ago

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>""" 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