25

How can I use postman plugin of Google Chrome to send a FormData() object to a webapi using POST. The FormData() object has form fields personID and messageBody appended to it. I tried something like this but to no avail:

URL of the webapi: http://localhost/<<appName>>/api/v1/message

Headers:
Accept:application/json
Content-Type:multipart/form-data; boundary=---XXX---

form-data:
personID:1 (Text)   
messageBody:Hello (Text)
Pool
  • 11,999
  • 14
  • 68
  • 78
rkshakya99
  • 439
  • 1
  • 5
  • 8
  • See https://stackoverflow.com/questions/12756688/is-it-possible-to-send-an-array-with-the-postman-chrome-extension. – CoolMind Apr 23 '19 at 09:26

2 Answers2

30

Postman has a form-data POST body option that automatically does this for you.

Abhinav
  • 38,516
  • 9
  • 41
  • 49
7

Yes finally I have made it work. What I was doing wrong was not setting all the fields of the FormData() object ie, I didn't set the fields such as orderId because its value was null. When I set all the field values even if they were null, it worked. And also there was no need to set the Content-Type when you are sending a multipart/form-data...

rkshakya99
  • 439
  • 1
  • 5
  • 8