3

For example, below is the JSON request data to "add a device" in the DB. For example, I want to add 10000 devices with different IMEI number and different phone number to the server for testing purpose. So, how to send the request at once. I'm ready to create 10000 devices data with different values manually. Now I can able to send one by one only.But how to send all the request at once?

{ "device_name":"34793812453274392", "imei_num":"36xxxxxxxxxxxx5", "phone_num":"8666606451", "device_city":"Chennai", "device_state":"Tamil Nadu", }

As I'm new to POSTMAN, required detailed info. Thanks in advance.

Mega
  • 95
  • 2
  • 2
  • 7

3 Answers3

4

The thing that should work is :

  • you prepare your input JSon body with variables. ie, from your example :

{ "device_name":{{device_name}}, "imei_num":{{imei_num}}, "phone_num":{{phone_num}}, "device_city":{{device_city}}, "device_state":{{device_state}}, } the {{}} is for variables

  • You create a CSV file with the corresponding headers (one for each variable of your input JSON) and all the values you need:

example:

line 1 : device_name, imei_num, phone_num, device_city, device_state
line 2 : "34793812453274392", "36xxxxxxxxxxxx5", "8666606451", "Chennai", "Tamil Nadu"
... and so on ...
line 10000 :  ... 

Then, in the Postman runner (see here ), you select the data file (Data / Select file) with CSV type (you should have an option to check the content, but be careful as you'll have a lots of rows, it may take a long time, I suggest you try first with a small CSV file)

You just set ONE iteration (otherwise you'll play x times 10000 requests). It will parse your file and, for each data line, it will send your request with replacing the body's variables by the corresponding data associated to the corresponding header. Header names must have the same label as your variables.

Launching the runner will launch your 10000 requests sequentially

If you prefer, you can use JSON input file as data file, see here

Don't hesitate to have a look at postman documentation, it's pretty complete.

A.Joly
  • 2,317
  • 2
  • 20
  • 25
2

There is an option called Runner at the top left corner of your Postman application. You can select the collection you need to run with number of iterations and delay time between each request. But the thing is you cannot alter the values inside the JSON request. Thanks

Kishor kumar R
  • 195
  • 2
  • 17
  • Thanks for the reply... That's right.. but i want to alter values.. i want to send different set of values for each request. – Mega Nov 24 '17 at 13:35
  • @A.Joly thanks... If possible can you help me out on that how to do with input file. I've searched, but i didn't get anything.. Thanks in advance – Mega Nov 24 '17 at 21:54
0

Put all the data into a JSON Array and then do them all as one post. Currently you only have one set of data you're posting in.

Just create a json body with all the data you need to enter and post them into the same API endpoint.

mvoase
  • 544
  • 1
  • 6
  • 20
  • Thanks.. I want to send those 3 values only.. The server will accept those 3 values only right.. how can i put the same data sets again.. please correct me if I'm wrong.. if possible, can you mention clearly with above example code... – Mega Nov 24 '17 at 13:38