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
Abhijit Shrikhande 10Abhijit Shrikhande 10 

How can I test the REST API for documents using workbench?

I wish to understand how the REST API works with document attachments. I found some links

Using this information, I wanted to test this in the workbench REST Explorer. So I composed the following request:
    "Description" : "Marketing brochure for Q1 2011",
    "Keywords" : "marketing,sales,update",
    "FolderId" : "00l70000001AG5g",
    "Name" : "Marketing Brochure Q1",
    "Type" : "pdf"

Content-Type: application/pdf
Content-Disposition: form-data; name="Body"; filename="2011Q1MktgBrochure.pdf"
519 0 obj
<</Linearized 1/L 855529/O 521/E 35857/N 12/T 845101/H [ 894 565]>>
519 29
0000000016 00000 n
0000001647 00000 n
0000001459 00000 n
0000000894 00000 n
<</Size 548/Prev 845089/XRefStm 1459/Root 520 0 R/Info 124 0 R/ID[<097E027FBE8C884598F32EB7C237FF5B><4080463A838922439FB92E5A73905FAB>]>>
547 0 obj
<</Length 476/C 591/Filter/FlateDecode/I 615/S 450>>stream
xÚb```f``¹ÀÀÊÀ ¦Ï Ì€


When I attempt to execute this using REST API - /services/data/v29.0/sobjects/Document
using the POST method, I get this error:
message: Extra JSON in request found after deserialization at: [line:9, column:3]

I wish to know how can I test this in the Rest Explorer
I think you missed the beginning part of the request body; something like
Content-Type: application/json

.... json content
... the rest of the response