After I delete an attachment via REST API, when I upload the same attachment via API, the request is successful - I get a 200 response code. However, there is no data in the attachment and it cannot be previewed. Any any idea why this is happening?
def upload_image(file, fb, parentID, url, data, auth, files, headers):
print("hello")
r = requests.post(url, data=data, auth=auth, files=files, headers=headers)
if r==200:
return r
elif r.status_code==400:
print("the image exists. updating the image")
imgid, version = get_attachment_id(file, parentID)
urld = base+imgid
r2 = requests.delete(urld, auth=auth)
r2 = upload_image(file, fb, parentID, url, data, auth, files, headers)
return r2
the attachments on the page:
