arrmani88
arrmani88

Reputation: 1082

How to upload multiple files using rest-client in vscode

I have a post API call, which allows me to upload multiple images within form-data parameter in Postman. As you can see below, I'm sending multiple images having the key images

enter image description here

I wanna implement the same thing using the extension rest-client in vscode.

Upvotes: 5

Views: 4409

Answers (1)

arrmani88
arrmani88

Reputation: 1082

Thanks to @Tomothy G.'s comment I found the solution, it looks like this:

### ---------------------------- UPLOAD FEED IMAGES ----------------------------
POST {{hostname}}/upload_feed_images
Authorization: {{token}}
Content-Type: multipart/form-data; boundary=boundary

--boundary
Content-Disposition: form-data; name="images"; filename="my_image.jpg"
Content-Type: image/jpeg

< /Users/anel-bou/Desktop/my_image.jpg
--boundary
Content-Disposition: form-data; name="images"; filename="my_image.jpg"
Content-Type: image/jpeg

< /Users/anel-bou/Desktop/my_image.jpg
--boundary--
### -------------------------------------------------------------------------

the parameter name="images" stands for the key that the files should belong to

Upvotes: 7

Related Questions