Hi,
I am trying to update the content of a page via rest API through a python script (I am using curl command though for the API calls):
My command to GET content of the page is this (always according to the Atlassian documentation):
command_get = f'curl -u {email}:{api_token} -X GET -H "Content-Type: application/json" {url} | python3 -m json.tool'
And I always receive successfully the entire content as a json file, I make my changes and then I try to update with json file looking exactly the same only that I have modified:
page_content['body']['storage']['value'] = updated_page_content
and incremented
page_content['version']['number'] by 1
I run the API PUT call like this:
command_update = f'curl -u {email}:{api_token} -X PUT -H "Content-Type:
application/json" -d {"page_content"} {url}'
and no errors are returned, but whatever I do the page in confluence never updates.
My url is:
url = 'https://<my_company_name>.atlassian.net/wiki/rest/api/content/'+page_id+'?expand=ancestors,space,version,body.storage'
where my_company_name is my company's name server. Also, when doing the PUT request using python's library requests like this:
requests.put(url, auth=(email, api_token), headers=headers, data=json.dumps(page_content))
I get a 400 as a response.status_code and a message stating upload as well, WHAT IS GOING ON? Why isn't it working on the confluence I see no changes in the page.
Please help...