Store IDs and reuse in another call


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

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 =, ({ 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.


Hi @Acadia101

You’re so close!

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

Great! Thanks this is what i needed

1 Like