Good Day: I have created a Python3 script to manipulate subpages and attachments on a Confluence system. The script can successfully list, create, and delete subpages, and can successfully list, upload, and delete attachments. However, when the script attempts to update the binary data of an attachment, a revision is made but the content of the revision is blank. (The original version retains the original content.)
When the revision is made via the script, the operation shows a status code of 200, and the process appears to work, but the content is blank nevertheless.
Here is the relevant code block:
url = 'https://<host>/rest/api/content/' + contentID + '/child/attachment/' + attachmentID + '/data'
headers = {
'Accept': 'application/json',
'X-Atlassian-Token': 'nocheck'
}
files = {'file': open(tempfile_path + '/' + file_to_copy, 'rb')}
r = requests.post(url, files = files, headers = headers, auth = (username, password))
When I use a browser to upload the revised file, the updated content appears on the revision.
Any assistance would be appreciated. Please bear with me, I am quite new to Confluence.
Thank you.