You need to sign in to do that
Don't have an account?
selrassy
Document upload via REST API
Hello,
I'm trying to upload a pdf using REST API into salesforce.
Here's the curl:
https://na1.salesforce.com/services/data/v20.0/sobjects/Document/
I'm doing a POST with a multipart/form-data. I'm sending the variable Body in the content containing my file.
Here's the error I'm getting:
[{"message":"Multipart message must include a non-binary part","errorCode":"INVALID_MULTIPART_REQUEST"}]
Any help?
Best Regards,
Sabine
Hi,
I have not used REST API before. Just trying to understand.
It seems body must consist of two parts, one is non-binary part(which contains information about the binary, e.g name , size etc.) and binary part(actual document body).
Hope this helps.
not With a .pdf or a .doc. Ill try tout figure it out. Thanks for the help.
Best Regards,
If you have succesfully inserted pdf document into Salesforce via REST api, let me know what is missed
Anyone have a resolution for this? Appreciate the answer!
Thank you for the reply.
Understand the attachement via REST API part.
However we are looking for Content Document Creation via REST API since the file size limit for attachments is not sufficient for our implementation.
Best Regards,
Satya
is there any limitation for Content Version ? Also what would be the size limit for the blob in REST request ? can it be multipart/formdata ?
Thanks
Parbati
I have only tested it on ContentVersion Objects, but it should also work for Document Objects
The following Salesforce link provides some details related to the contents of the POST Request
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/dome_sobject_insert_update_blob.htm
In there it describes how you must send both a Binary and non-Binary Content-Type, which isn't easy (the proposed solution is to manually build your request)
Below is my code snippet for ContentVersion Object
Whilst I haven't tested it, below is what the code should look like for Documents (using the example JSON data from the link at the top of my response)
Hope this helps.
ds la colonne <content type> mettre la valeur <application/json>
ce qui donne au final