I am trying to programmatically update a confluence using the Python API. It is working the get page requests, I am able to retrieve contents from the page using page ID. The problem is for update requests, where it is giving "requests.exceptions.HTTPError: 415 Client Error: for url: https://confluence.<domain_name>.com/rest/api/content/".
Here is the code that I am using :
confluence = Confluence(
token = PAT)
# This request is working, and page_contents is storing all the contents of the requested page
page_contents = confluence.get_page_by_id(page_id='XXXXXXX' expand='body.storage')
data = '<p>This is the new updated text of the page</p>'
# This is the request that is not working
confluence.update_page("XXXXXXX", 'Python Confluence Tests', data)
What I've tried :
- I've tried to create a new page to check if updating that works,
- http/https to see if that makes any difference
- I've also tried the REST API, using requests. It gives the same error for PUT requests.
Am I missing something obvious? Any help would be highly appreciated.