function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ravi RoyRavi Roy 

Not able to view attachment in salesforce, when uploaded through Multipart Rest API

Header Content-Type: multipart/form-data; boundary=boundary_string
Content-Disposition: form-data; name="entity_Attachment";
Content-Type: application/json

{  
    "Description" : "Marketing Q1 2011",
    "ParentId" : "00Q1700000BLt9F",
    "Name" : "Marketing Brochure Q1"
}

--boundary_string
Content-Type: application/pdf
Content-Disposition: form-data; name="Body"; filename="2011Q1MktgBrochure.pdf"

Zm9yIHRoZSByZX..........DQoNCg0KDQoNCg0KDQo

--boundary_string--

I've also tried adding Content-Transfer-Encoding: base64 just below Content-Type: application/pdf ​​​​​​, but that also isn't working.
vlad testingvlad testing
Hey!

Try to do something like that
 
POST https://eu6.salesforce.com/services/data/v40.0/sobjects/Attachment

Accept: application/json
Authorization: Bearer $your_access_token_here


{
    "Description": "desc",
    "Body": "MTIzNDU=",
    "Name": "task.txt",
    "ParentId": "00T58000004fLbeEAE",
    "OwnerId": "00558000000dmueAAA",
    "ContentType": "text\/plain"
}

Body is base64 decoded file body

In PHP base64_decode(file_get_contents($file));