It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Attaching image to Confluence page via restful API (Python) Edited


I'm trying to attach image files to an existing Confluence page from Python, using the restful API. Other requests I am making (creating or updating pages) work fine, but I keep a getting a 500 Server Error whenever sending the POST request for attaching images.

I don't see what I'm doing wrong, but I also have very little HTTP experience. Here's my little bit of code: 

with open(filePath, 'rb') as fp:
# I know I am getting either .jpg or .png here, just extracting that info for the contentType
contentType = 'image/%s' % os.path.splitext(filePath)[1].replace(".", "").lower()
contentType = str(contentType.replace("jpg", "jpeg"))

files = {'file': (filePath, fp, contentType)}
headers = {'X-Atlassian-Token': 'nocheck'}

# url, user, password and pageID are all correct values
r = + "/%s/child/attachment" % str(pageID),
headers=headers, files=files,
auth=(user, password))


1 answer

Solved this, the problem seemed to simply be "nocheck" instead of "no-check".

Bonus question though: is there any way to disable e-mail notifications when attaching or deleting attachements to a page?

I tried adding:

data={'version': {'minorEdit': True}}

 But that doesn't seem to have an effect.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

283 views 9 7
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you