How to set multiple json data to a one time request using external json file

Hi all, I am new to postman and I have a requirement to send a http request to create a multiple variables in a single aspect.
ie: one aspect has many variables.

for your information: to create something new in the server I have to use PUT method. And it worked fine.

so this is my request body.

data to the request body “variables” , I am passing through external json file in my local machine.

so this is my json file.

so when I use this file to run the collection using Runner , It was only created one object. (json file has 3 objects) other two objects are not created.

how can I read this json file in one go.

Any help would be appreciated.

The moment you upload the JSON file, the collection runner reads the number of entries that are there and sets the iteration count, like so:

Then as soon as you press Run, each request will now run for 3 times in succession, and data for each iteration will be passed accordingly.

Question is, when you run your collection do you see these iterations being performed?
When you upload the data file, do you see the iteration count set as 3?
If not, can you make it 3 and check?

@sivcan , thank you for the quick reply.
here I attach what i performed. so as you can see the preview data.

That’s correct, that means runner is providing the correct data and running the correct number of iterations for your request.
Can you check the runner view?

It should look something like this (Showing the iterations distinctly):

That means, it’s correctly hitting your server also with the correct data.
You might want to check your server code, the issue probably lies there.

this where I getting problem, here I attached the run result.
so the first json object is created, but other two are not created.

As I can see in the image that you shared, you’re getting a 402 - Precondition Failed error.

This error is being thrown by the server, you should check the server code as to why this is failing.
For more help, you can use the Postman Console to view each request being sent out in a separate view.

To open the Postman Console - View > Show Postman Console

It seems like variables array index always showing 0. It should something like 0,1,2 , is it ?
if that’s the case how can I write a pre-request-test to loop through the json file , if possible ?

server code is out of my control! I’m using thier apis.

Your Request Body has an array called variables which has only 1 entry -

So, when an array is like ->

let arr = [{ variables: 2}]

then array only has only one item which can be accessed using the 0th index.
That’s why the index won’t change in the iterations because it’s just a view which is listing the items in the array, irrespective of anything going to the server.
Also, the data from Postman is going as expected as I can see from the screenshot.

You should read the error message in the response body if there is any from the api.

How to add multiple json array data in an external Json file? Is it possible ?