Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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

Update Confluence page with Python using REST API?


I am trying to update a confluence page using Python.  I have tried the curl examples that are here in the community forums, but struggling with python.

I am getting 405 and am guessing I have something malformed.  

Any help will be greatly appreciated!


print ("NEW PAGE: \n" + new_page) 
print ("Updating page @ " + dataAPI)
headers = {'Content-type': 'application/json', 'Accept' : 'application/json'}
result =, auth=HTTPBasicAuth(username, password), verify=False, json=new_page, headers=headers )
print (result)


Getting Confluence Page Version number
Retriving from https://XXXXXXXX.XXX.XXXX.XXX/confluence/rest/api/content/376006486
old_version : 15, new_version : 16
{"id":"376006486","type":"page","title":"Patterns Summary Data","space":{"key":"XXXXXXX"},"body":{"storage":{"value":"<ac:structured-macro ac:name=\"chart\" ac:schema-version=\"1\" ac:macro-id=\"304d2585-1d15-4851-8867-90bcb2c2c926\"><ac:parameter ac:name=\"dataOrientation\">vertical</ac:parameter><ac:rich-text-body><table class=\"wrapped\" style=\"text-align: left;\"><colgroup><col /><col /></colgroup><tbody><tr><th style=\"text-align: left;\"><p>All Time Status</p></th><th style=\"text-align: left;\"><p>count of Patterns</p></th></tr><tr><td style=\"text-align: left;\"><p>ARCHIVED</p></td> <td style=\"text-align: left;\"><p>1</p></td></tr><tr><td style=\"text-align: left;\"><p>ENDORSED</p></td> <td style=\"text-align: left;\"><p>19</p></td></tr><tr><td style=\"text-align: left;\"><p>PROPOSED</p></td> <td style=\"text-align: left;\"><p>6</p></td></tr><tr><td style=\"text-align: left;\"><p>SOCIALISED</p></td> <td style=\"text-align: left;\"><p>13</p></td></tr><tr><td style=\"text-align: left;\"><p>UNDER DEVELOPMENT</p></td> <td style=\"text-align: left;\"><p>14</p></td></tr><tr><td style=\"text-align: left;\"><p>WITHDRAWN</p></td> <td style=\"text-align: left;\"><p>5</p></td></tr></tbody></table></ac:rich-text-body></ac:structured-macro><p><br /></p>","representation":"storage"}},"version":{"number":16}}}
Updating page @ https://XXXXXXXX.XXX.XXXX.XXX/confluence/rest/api/content/376006486
<Response [405]>
Error : 405 

2 answers

Finally figured it out.     

Should be requests.put, (not

I've obviously been looking at it for too long!

Hi Jarrod, You seemed to have coded something that I just started looking and that is updating a page which has a confluence macro. It seems I have not figured out the correct python code for the insertion of <ac:structured........ I wonder whether you would be kind enough to share that part of the python code?



Suggest an answer

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

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

342 views 23 8
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