Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

add visible images to Confluence using python

Katie Harding August 24, 2021

I am able to update a page using this:

confluence.update_page(my_page, my_title, my_body, parent_id=my_id,
type='page', representation='storage', minor_edit=False)

I would like to add visible images (much like I do with  pasting images in manually)

I've tried this:

filename = 'images/conc_v_input.png'
confluence.attach_file(filename, page_id=my_page)

and this:

https://community.atlassian.com/t5/Confluence-questions/How-do-i-import-images-within-html-using-Confluence-API/qaq-p/1414591

 

Which doesn't work since the image is only available on my computer.  I also don't want the image there as a link, but as an actual image.    

Eventually I would like to add tables too, if someone could point me to that.

2 answers

1 accepted

1 vote
Answer accepted
Katie Harding October 18, 2021

filename = 'images/conc_v_input.png'

confluence.attach_file('images/conc_v_input.png', page_id=test_analysis)
image = '<ac:image> <ri:attachment ri:filename="conc_v_input.png" /> </ac:image>'

confluence.append_page(my_page, my_title, image, parent_id=test_analysis,
type='page', representation='storage', minor_edit=False)

0 votes
Katie Harding August 24, 2021

Ideally I would like something where I can add multiple images with 

new_image = {filename: 'image.png', title: 'My cool image', description:'something to say about the image'}

my_body = my_body+new_image

Jonathan Bradbury
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 17, 2021 edited

edit: Looked into it a little bit today and figured something out that works, figured i'd share. Info is on another post you made.

https://community.atlassian.com/t5/Confluence-questions/Python-API-add-image-to-Confluence/qaq-p/1786120#M223016

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
atlassian, knowledge sharing, intentional knowledge sharing playbook, loom, confluence, team collaboration, knowledge management, workplace productivity, information silos, documentation best practices, internal communication, knowledge sharing strategies

Conquer collaboration chaos with Loom + Confluence

You don't need more tools. You need tools that actually work together – the way humans do. See how Loom + Confluence help teams collaborate with more context, more connection, and fewer calendar invites. 💪

See inside
AUG Leaders

Atlassian Community Events