# Problemns with repeat request

**URL:** <https://community.postman.com/t/problemns-with-repeat-request/7696>\
**Category:** Help Hub\
**Created:** [September 10, 2019, 8:58pm UTC](https://community.postman.com/t/problemns-with-repeat-request/7696 "2019-09-10T20:58:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![LucasNovaesDragojevi](https://avatars.discourse-cdn.com/v4/letter/l/96bed5/32.png) [@LucasNovaesDragojevi](https://community.postman.com/u/LucasNovaesDragojevi)\
**Post date:** [September 10, 2019, 8:58pm UTC](https://community.postman.com/t/problemns-with-repeat-request/7696/1 "2019-09-10T20:58:44Z")

</div>

**Describe the bug**  
I need to do multiple requests using JSON for my API changing the ID of request.  
I have tried to create a loop of request using variables but did not have success.

**Specifications of my test**

**Enviroment Name:** Test

**Enviroment Variables:**

> Variable: index  
> Initial value: 0  
> Current value: 0

**Params** have nothing.

**Authorization** is empty.

**Headers**

> Key: Content-Type  
> Value: application/json

**Body**

> { “ID”: {{index}} }

**Pre-request Script**

```
pm.environment.set("index", String(parseInt(pm.environment.get("index"))+1));

```

**Tests**

```
if (parseInt(pm.environment.get("index")) < 10)
{
    postman.setNextRequest("API Address");
}
else
{
    postman.setNextRequest(null);
}

```

**App information (please complete the following information):**

- Java Servlet.
- Postman v7.6.0
- Local machine: Windows 10; Server: Linux Ubuntu.

Thanks for helping.

---

<div class="post-metadata">

**Author:** ![suraj.purohit](https://avatars.discourse-cdn.com/v4/letter/s/858c86/32.png) [@suraj.purohit](https://community.postman.com/u/suraj.purohit)\
**Post date:** [September 10, 2019, 10:04pm UTC](https://community.postman.com/t/problemns-with-repeat-request/7696/2 "2019-09-10T22:04:08Z")

</div>

Hi Lucas,

Welcome to community 👋

I have attached a sample collection below which successfully makes repeated requests. Please take a look at it.  
[https://www.getpostman.com/collections/aa170b22547a79f39bda](https://www.getpostman.com/collections/aa170b22547a79f39bda)

Hope this helps.
