+ Start a Discussion
Venkatesh SVenkatesh S 

Rest API PDF Document is stored as base64 and not getting opened

Hello All,

I am using 3rd party document drive.  I am sending files from salesforce via rest api.  All the files are stored as base64 and not getting opened when it is downloaded.  What i am sending is as follows,
'Content-Type','multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'

Content-Disposition: form-data; name="metadata"

Content-Disposition: form-data; name="files"; filename="helloworld6.pdf"

JVBERi0xLjUNCiW1tbW1DQ**removed base64**

The document is sent to document drive USER_DEBUG [37]|DEBUG|System.HttpResponse[Status=OK, StatusCode=200]

But the document is not getting opened.  It is always showing error, when i tried to open the document in sublime, it shows the base64 code.  Please help me.

when i tried this data in postman it is working correctly, please tell me what content type are used in post man, the generate code not generating content type for files that i have uploaded.

User-added image

NagendraNagendra (Salesforce Developers) 
Hi Venkatesh,

Try with below-changed code:
Content-Disposition: form-data; name="Body"; filename="helloworld6.pdf"
Hope this helps.

Mark this as solved if it's resolved.

Best Regards,