Is it possible to send an array with the Postman C

2019-01-04 05:19发布

I've been using Postman Chrome extension to test out my API and would like to send an array of IDs via post. Is there a way to send something list this as a parameter in Postman?

{
  user_ids: ["1234", "5678"]
}

16条回答
我命由我不由天
2楼-- · 2019-01-04 06:20

Set Body as raw and form the array as follows:

enter image description here

查看更多
在下西门庆
3楼-- · 2019-01-04 06:21

this worked for me. to pass an array of Item object {ItemID,ColorID,SizeID,Quntity}

Postman data

查看更多
迷人小祖宗
4楼-- · 2019-01-04 06:23

It is important to know, that the value field is only allowed to contain a value (no specifiers).

If you want to send e.g. an array of "messages" with Postman, each having a list of key/value pairs, enter e.g. messages[][reason] as the key and the value of reason under value:

enter image description here

The server will receive:

{"messages"=>[{"reason"=>"scrolled", "tabid"=>"2"}, {"reason"=>"reload", "tabid"=>"1"}], "endpoint"=>{}}
查看更多
ゆ 、 Hurt°
5楼-- · 2019-01-04 06:24

Here is my solution:

use form-data and edit as below:

Key       Value 
box[]      a
box[n1]    b
box[n2][]  c
box[n2][]  d

and you will get an array like this:

{"box":{"0":"a","n1":"b","n2":["c","d"]}}
查看更多
登录 后发表回答