# How to efficently chain API requests endpoints

**URL:** <https://community.postman.com/t/how-to-efficently-chain-api-requests-endpoints/2830>\
**Category:** Help Hub\
**Created:** [October 1, 2018, 2:20pm UTC](https://community.postman.com/t/how-to-efficently-chain-api-requests-endpoints/2830 "2018-10-01T14:20:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdc065](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/jdc065/32/961_2.png) [@jdc065](https://community.postman.com/u/jdc065)\
**Post date:** [October 1, 2018, 2:20pm UTC](https://community.postman.com/t/how-to-efficently-chain-api-requests-endpoints/2830/1 "2018-10-01T14:20:53Z")

</div>

Hello all,  
I have been working with Postman for the last two months;  
I have been testing an API that chains lots of API endpoints request to create an environment; I need to pass values from an endpoint to another;  
Is there a faster way to do it, I mean, Can we code the requests and pick the answers in a coding language function and not only with the normal PostMan interface of pre-test and post-test examples.  
For instance, use Python to create a function that chains all the API’s and passes the data from a response to a request.

---

<div class="post-metadata">

**Author:** ![ankit-m](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/ankit-m/32/979_2.png) [@ankit-m](https://community.postman.com/u/ankit-m)\
**Post date:** [October 3, 2018, 4:34pm UTC](https://community.postman.com/t/how-to-efficently-chain-api-requests-endpoints/2830/2 "2018-10-03T16:34:08Z")

</div>

You chain requests and create workflows using `pm.setNextRequest`. You can read more about building workflows here - [https://learning.getpostman.com/docs/postman/collection\_runs/building\_workflows/#advanced-workflow](https://learning.getpostman.com/docs/postman/collection_runs/building_workflows/#advanced-workflow).

To pass data from one request to another, you should use environment variables. Set/retrieve data from them in the pre-request script or test script (post request). You can find information about the sandbox API here - [https://learning.getpostman.com/docs/postman/scripts/postman\_sandbox/#pm-apis](https://learning.getpostman.com/docs/postman/scripts/postman_sandbox/#pm-apis)
