Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send a parameter which is dictionary in Postman

Tags:

postman

I have just started using Postman for testing my API. I am able to send list of request parameters, but could not figure out how will I send a parameter which is a dictionary,

say my request has two different parameters, first is property, and the structure of property is something like "ptype":"residential","mtype":"requirement","dtype":"sale","category":"multistoryapt","city":"Gurgaon,Mumbai"

How can I send these parameters together ? I have explored on internet and there are ways of sending an array but not a dictionary.

Am I missing something ?

like image 364
Geek_To_Learn Avatar asked Sep 24 '15 06:09

Geek_To_Learn


4 Answers

You can do it with this:

POST Request in Postman:

Content-Type: Json/Application

{
   "IsManual":true,
   "platform":"IOS",
   "barcodeList":{"1":"DSSDsdsdsas","2":"DSSDsdsdsas"},
   "Client":"Cliente1",
   "ScanDate":"2018-10-16T17:03:02.2347052-03:00"
}
like image 60
Maximiliano Cesán Avatar answered Sep 19 '22 10:09

Maximiliano Cesán


You could send data as raw body with the Content-Type application/json, this way it's up to you how the data is structured.

like image 8
Andre Avatar answered Oct 18 '22 21:10

Andre


If you want to send it in the application/json format then the body should look like this:

{
    "key1":"value1",
    "key2":"value2"
}

For a comprehensive resource on how to serialise JSON go to http://www.newtonsoft.com/json/help/html/SerializingCollections.htm

like image 6
tonycdp Avatar answered Oct 18 '22 23:10

tonycdp


If for some reason you cannot send it with json, here is how we send dictionaries in the form:

object[ptype], object[mtype], object[dtype], object[category], object[city]
like image 4
Simon Avatar answered Oct 18 '22 21:10

Simon