# Store IDs and reuse in another call

**URL:** <https://community.postman.com/t/store-ids-and-reuse-in-another-call/10300>\
**Category:** Help Hub\
**Created:** [January 23, 2020, 4:31pm UTC](https://community.postman.com/t/store-ids-and-reuse-in-another-call/10300 "2020-01-23T16:31:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Acadia101](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@Acadia101](https://community.postman.com/u/Acadia101)\
**Post date:** [January 23, 2020, 4:31pm UTC](https://community.postman.com/t/store-ids-and-reuse-in-another-call/10300/1 "2020-01-23T16:31:48Z")

</div>

Hi,

This questions is probably easy for a lot of you… but how do i store ids from one response and use them in another request?

Below is my scenario

From my original response i get the below JSON

{  
“submissions”: [  
{  
“id”: “MDg2YzU5NGItNWY2Zi00YzllLThkOGUtYjJjNGE5MTg2NTdiXzA”,  
“dataset\_type”: “CRIF”,  
“valuation\_date”: “2019-11-07”,  
“org\_id”: “uat42hxj09f7”,  
“legal\_entity\_id”: “uat43q2j5lwr”,  
“organization”: “CAS”,  
“legal\_entity”: “Transamerica 0L6CM7SPOSGAEQJK0J73”,  
“calculation\_level”: “Entity”,  
“total\_trade\_count”: 168,  
“total\_agreement\_count”: 18,  
“agreements”: [  
{  
“id”: “ **MDg2YzU5NGItNWY2Zi00YzllLThkOGUtYjJjNGE5MTg2NTdiXzE** ”,  
“legalEntityId”: “uat43q2j5lwr”,  
“agreement\_id”: “C3OCPGNVXRG2HDIJP5DA43Y6JE7BZ1”,  
“portfolio\_id”: “C3OCPGNVXRG2HDIJP5DA43Y6JE7BZ1”,  
“cp\_organization”: “C Test”,  
“cp\_org\_id”: “uat43q2j5q9f”,  
“cp\_legal\_entity\_id”: “uat43q2j5rjt”,  
“legalEntity”: " 0L6CM7SPOSGAEQJK0J73",  
“cp\_legal\_entity”: “D LN”,  
“trade\_count”: 4,  
“baseCurrency”: “USD”  
},  
{  
“id”: “ **MDg2YzU5NGItNWY2Zi00YzllLThkOGUtYjJjNGE5MTg2NTdiXzI** ”,  
“legalEntityId”: “uat43q2j5lwr”,  
“agreement\_id”: “C3OCPGNVXRG2HDIJP5DA43Y6JE7DZ1”,  
“portfolio\_id”: “C3OCPGNVXRG2HDIJP5DA43Y6JE7DZ1”,  
“cp\_organization”: “C Test”,  
“cp\_org\_id”: “uat43q2j5q9f”,  
“cp\_legal\_entity\_id”: “uat43q2j5rli”,  
“legalEntity”: “0L6CM7SPOSGAEQJK0J73”,  
“cp\_legal\_entity”: “D NY”,  
“trade\_count”: 5,  
“baseCurrency”: “USD”  
},  
{  
“id”: **"MDg2YzU5NGItNWY2Zi00YzllLThkOGUtYjJjNGE5MTg2NTdiXzM**",  
“legalEntityId”: “uat43q2j5lwr”,  
“agreement\_id”: “C3OCPGNVXRG2HDIJP5DA43Y6JE7FZ1”,  
“portfolio\_id”: “C3OCPGNVXRG2HDIJP5DA43Y6JE7FZ1”,  
“cp\_organization”: “C Test”,  
“cp\_org\_id”: “uat43q2j5szc”,  
“cp\_legal\_entity\_id”: “uat43q2j5t5h”,  
“legalEntity”: “0L6CM7SPOSGAEQJK0J73”,  
“cp\_legal\_entity”: “454354fdzx”,  
“trade\_count”: 2,  
“baseCurrency”: “USD”  
}  
]  
}

I then want to use the highlighted IDs from the response in another request where the request is  
[https://servername/check/Ids](https://servername/check/Ids)

I’m not sure if this is correct by in the tests section where i want to get my IDs from i inserted the below code

> let response = pm.response.json(),

> ids = \_.map(response.items, ({ id }) =\> ( id ));

`pm.variables.set('ids', JSON.stringify(ids));`

but not sure how i then use the ids to generate the requests.

Can someone kindly help.

Thanks

---

<div class="post-metadata">

**Author:** ![john-paul](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/john-paul/32/919_2.png) [@john-paul](https://community.postman.com/u/john-paul)\
**Post date:** [January 23, 2020, 9:48pm UTC](https://community.postman.com/t/store-ids-and-reuse-in-another-call/10300/2 "2020-01-23T21:48:03Z")

</div>

Hi @Acadia101

You’re so close!

You can include the variable `ids` in a request by including `{{ids}}` wherever it’s needed.

---

<div class="post-metadata">

**Author:** ![Acadia101](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@Acadia101](https://community.postman.com/u/Acadia101)\
**Post date:** [January 24, 2020, 9:32am UTC](https://community.postman.com/t/store-ids-and-reuse-in-another-call/10300/3 "2020-01-24T09:32:44Z")

</div>

Great! Thanks this is what i needed
