# Looping on same api

**URL:** <https://community.postman.com/t/looping-on-same-api/58228>\
**Category:** Help Hub\
**Tags:** collections\
**Created:** [February 28, 2024, 9:30am UTC](https://community.postman.com/t/looping-on-same-api/58228 "2024-02-28T09:30:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rashabadri](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@rashabadri](https://community.postman.com/u/rashabadri)\
**Post date:** [February 28, 2024, 9:30am UTC](https://community.postman.com/t/looping-on-same-api/58228/1 "2024-02-28T09:30:06Z")

</div>

Dear All  
i have a case of creating companies  
each company has different number of employees  
i need to loop on add employee details api, which contains uploading profile image  
i tried to loop on number of employee and use postman.setNextRequest(“api name”); but i doesn’t work  
i tried to add the the api script in the for loop, but i got Uploading files from scripts is not allowed

is their a solution for this case

---

<div class="post-metadata">

**Author:** ![gbadebo-bello](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/gbadebo-bello/32/12175_2.png) [@gbadebo-bello](https://community.postman.com/u/gbadebo-bello)\
**Post date:** [February 28, 2024, 1:36pm UTC](https://community.postman.com/t/looping-on-same-api/58228/2 "2024-02-28T13:36:00Z")

</div>

Hi @rashabadri. Welcome to the Postman community!

Can you share how you used `postman.setNextRequest(“api name”)` to loop over a request. Ideally, I expect it to work if correctly done.

---

<div class="post-metadata">

**Author:** ![rashabadri](https://avatars.discourse-cdn.com/v4/letter/r/8797f3/32.png) [@rashabadri](https://community.postman.com/u/rashabadri)\
**Post date:** [February 29, 2024, 11:11am UTC](https://community.postman.com/t/looping-on-same-api/58228/3 "2024-02-29T11:11:46Z")

</div>

@gbadebo-bello the request has in the body, dataform with upload doc  
fist run it take the doc and add it in the request  
when looping on same request, the doc is not added to them

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [March 30, 2024, 11:12am UTC](https://community.postman.com/t/looping-on-same-api/58228/4 "2024-03-30T11:12:05Z")

</div>

Closed on March 30, 2024, 11:12am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
