Hello guys.
I need to update a page using REST API and Python, but I can not do it. I get these errors:
DEBUG :09/08/2023 12:07:01 Starting new HTTP connection (1): confluence.xxx.net:80
DEBUG :09/08/2023 12:07:01 http://confluence.xxx.net:80 "PUT /rest/api/content/534283271 HTTP/1.1" 301 169
DEBUG :09/08/2023 12:07:01 Starting new HTTPS connection (1): confluence.xxx.net:443
DEBUG :09/08/2023 12:07:01 https://confluence.xxx.net:443 "PUT /rest/api/content/534283271 HTTP/1.1" 415 0
This is what I do:
url = "http://confluence.xxx.net/rest/api/content/534283271"
# New content for the page
new_content = """ <p>This is the updated content for the page.</p> """
payload = {'username': 'bob', 'email': 'bob@bob.com'}
try:
# Make the API request to update the page
response = requests.put(url,
auth = HTTPDigestAuth(dConnection.get('username'),
dConnection.get('password')),
headers = {"Content-Type": "application/json"},
data = payload,
verify = False
)
...
...
Tried different options like changing headers, data content, etc without success.
Note: I can read from Confluence using REST API without issues.
Perhaps someone can show me the light 😊
Regards
Javier