How Can We Help?
< All Topics
Print

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')

Please suggest edits or add your comments.

Your email address will not be published. Required fields are marked *

Scroll to Top