How Can We Help?
Uploading a document to an opportunity
path = "test.png"
with open(path, "rb") as f:
encoded_string = base64.b64encode(f.read())
ContentVersion = sf_api_call('/services/data/v40.0/sobjects/ContentVersion', method="post", data={
'Title': 'An image',
'PathOnClient': path,
'VersionData': encoded_string,
})
ContentVersion_id = ContentVersion.get('id')