Skip to content Skip to sidebar Skip to footer

Uploading Attachments To Salesforce Api Via Beatbox, Python

I'm uploading documents to Salesforce using beatbox and python and the files are attaching correctly but the data contained within the files gets completely corrupted. def Send_Fil

Solution 1:

the 'body' value in the dictionary should be the base64 encoded contents of the file, not the file name. you need to read and encode the file contents yourself. e.g.

body = ""withopen("/Users/My_Files/untitled.txt", "rb") as f:
    body = f.read().encode("base64")

update_dict = {
    'type' : 'Attachement''ParentId' : accountId,
    'Name' : 'untitled.txt',
    'Body' : body }

...

Docs about Attachment

Post a Comment for "Uploading Attachments To Salesforce Api Via Beatbox, Python"