Postman send multiple binaries (multipartform-data) in one request

30 Views Asked by At

I'm trying to test a request to an API where I need to send multiple binaries (first JSON than eg. PDF) as attachment.

I can successfully transmit the data with CURL, but I'm failing to reproduce the request with Postman:

curl {{_endpoint}}/services/data/v{{version}}/sobjects/Attachment \
  --header 'Authorization: Bearer {{sessionId}}' \
  --header 'Content-Type: multipart/form-data; boundary="EfNIbdHvhqRx456FprGBA3NaQa8Bh2US"' \
  --data-binary '@./data.txt' \
  -X POST

The content of the binary (data.txt) is structured like the following:

--EfNIbdHvhqRx456FprGBA3NaQa8Bh2US
Content-Disposition: form-data; name="Data";
Content-Type: application/json

{
    "Name":"test.pdf",
    "ParentId":"xxx"
}

--EfNIbdHvhqRx456FprGBA3NaQa8Bh2US
Content-Type: application/pdf
Content-Disposition: form-data; name="Body"; filename="test.pdf"

%PDF-1.5
%äüöß
2 0 obj
<</Length 3 0 R/Filter/FlateDecode>>
stream

[...]

%%EOF

--EfNIbdHvhqRx456FprGBA3NaQa8Bh2US--

How can I reproduce this call in Postman, eg. to make it dynamical testable?

0

There are 0 best solutions below