# How to call many requests at once using CSV, with single iteration

**URL:** <https://community.postman.com/t/how-to-call-many-requests-at-once-using-csv-with-single-iteration/20155>\
**Category:** Help Hub\
**Tags:** collections, csvdatafile\
**Created:** [February 8, 2021, 7:10am UTC](https://community.postman.com/t/how-to-call-many-requests-at-once-using-csv-with-single-iteration/20155 "2021-02-08T07:10:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![orbital-module-sagan](https://avatars.discourse-cdn.com/v4/letter/o/a6a055/32.png) [@orbital-module-sagan](https://community.postman.com/u/orbital-module-sagan)\
**Post date:** [February 8, 2021, 7:10am UTC](https://community.postman.com/t/how-to-call-many-requests-at-once-using-csv-with-single-iteration/20155/1 "2021-02-08T07:10:25Z")

</div>

Hello all, as an addition to my previous topic that I couldn’t find an answer: [How to combine several json bodies with same structure but different values in 1 request](https://community.postman.com/t/how-to-combine-several-json-bodies-with-same-structure-but-different-values-in-1-request/19691) I’d like to ask my question in other words.  
I have a collection of requests:

- Create account
- Login
- Start - (showing what the first question will be)
- Next question - I can call every single question with this request and depending on the response I can call the next one with the same request.  
I’m using this approach at the moment, but with many “Next question” POST requests.

My task is to call them with a single request.  
How to do that using CSV file? The main thing is to check if every next question is the one that is expected.

Best regards,

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [February 15, 2021, 12:35pm UTC](https://community.postman.com/t/how-to-call-many-requests-at-once-using-csv-with-single-iteration/20155/2 "2021-02-15T12:35:52Z")

</div>

I assume you mean a single request that you iterate over a bunch of times?

So you’re sending a request and it comes back with a “next question” value. You want to do an assertion on that value then start the loop again?

---

<div class="post-metadata">

**Author:** ![PAtanasoff](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@PAtanasoff](https://community.postman.com/u/PAtanasoff)\
**Post date:** [February 17, 2021, 6:02am UTC](https://community.postman.com/t/how-to-call-many-requests-at-once-using-csv-with-single-iteration/20155/3 "2021-02-17T06:02:49Z")

</div>

That’s correct, I’m sending a request and it comes back with a ‘next question ID’.  
Here you can see my body every time:  
{  
“answerBody”: {“value”: “{{answerBody}}”}, - different every time  
“answerType”: {{answerType}}, - can be the same or different  
“answerGroupId”: {{answerGroupId}}, - can be the same or different  
“id”: {{id}} - next question’s ID (different every time)  
}

So I need to repeat this until the last question. I also need to do it with a single request and using CSV file.  
I hope it’s clear.

Best regards,

---

<div class="post-metadata">

**Author:** ![allenheltondev](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/allenheltondev/32/31738_2.png) [@allenheltondev](https://community.postman.com/u/allenheltondev)\
**Post date:** [February 17, 2021, 12:33pm UTC](https://community.postman.com/t/how-to-call-many-requests-at-once-using-csv-with-single-iteration/20155/4 "2021-02-17T12:33:01Z")

</div>

Why do you need to do it with a CSV _and_ have it be dynamic? Those things don’t seem to go together.

What data is coming out of the csv?

---

<div class="post-metadata">

**Author:** ![pranavdavar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/pranavdavar/32/9152_2.png) [@pranavdavar](https://community.postman.com/u/pranavdavar)\
**Post date:** [February 17, 2021, 6:16pm UTC](https://community.postman.com/t/how-to-call-many-requests-at-once-using-csv-with-single-iteration/20155/5 "2021-02-17T18:16:03Z")

</div>

If I understood correctly, you need to take the id from response of your previous request and take other values from .csv file.

To do so you can update the environment or collection variable and set the questionId from there using test script. That value set can be used in next iteration. Rest values could be taken sequentially.

Hope this helps

---

<div class="post-metadata">

**Author:** ![PAtanasoff](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@PAtanasoff](https://community.postman.com/u/PAtanasoff)\
**Post date:** [February 18, 2021, 3:52pm UTC](https://community.postman.com/t/how-to-call-many-requests-at-once-using-csv-with-single-iteration/20155/6 "2021-02-18T15:52:04Z")

</div>

@pranavdavar, You understand it correct! I like the suggestion, but may I see how the test script should look like?

Thanks in advance!  
Best regards

---

<div class="post-metadata">

**Author:** ![PAtanasoff](https://avatars.discourse-cdn.com/v4/letter/p/e99b99/32.png) [@PAtanasoff](https://community.postman.com/u/PAtanasoff)\
**Post date:** [February 18, 2021, 3:54pm UTC](https://community.postman.com/t/how-to-call-many-requests-at-once-using-csv-with-single-iteration/20155/7 "2021-02-18T15:54:46Z")

</div>

@allenheltondev, This is my task, that’s why. CSV will contain variables, so I can take everything from there.

Best regards.

---

<div class="post-metadata">

**Author:** ![pranavdavar](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/pranavdavar/32/9152_2.png) [@pranavdavar](https://community.postman.com/u/pranavdavar)\
**Post date:** [February 19, 2021, 1:59pm UTC](https://community.postman.com/t/how-to-call-many-requests-at-once-using-csv-with-single-iteration/20155/8 "2021-02-19T13:59:13Z")

</div>

I am assuming, the response from the previous request looks as below.  
{  
“questionId”: “1234567890”  
}  
Test Script will look like:  
`pm.environment.set(pm.response.json().questionId,'id');`  
In the above example, I have used environment variables, you may use global or collection based on the requirement.

This variable value will be accessible in the next run as now I have set to the environment. Once the run is completed it will update the value, that could be fetched from response of the request.
