Same get request with multiple Variables

I’m using a get request to return the DeviceIDs from a response body.

The request uses a TagID to determine which set of DeviceIDs to get.
I have ~10 TagIDs which I need to gather the DeviceIDs for.

Currently i’m defining the TagID with an Environment variable, and using a pre-script to set the TagID in the URI, then saving the Device IDs in a global variable.

The two problems:

  1. I need to loop through these TagIDs without having 10 separate requests.
  2. I need to Append the DeviceIDs pulled from the response body to the same variable.
    So it would be Response1 + Response2 + Response3, instead of just replace 1 with 2 with 3.

pm.environment.set("TagID", pm.environment.get("BB Primary Firewalls"));


let body = pm.response.json(),
ids =, (id) => id['@href'].split("/")[5]);

pm.globals.set("DeviceID", ids);

I think i could do something like

let tagVariables = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];

To set an array, where the numbers are the actual TagIDs (or even better if there is a way i could call the Environment/Global Variables i’ve already defined for these TagIDs), and then somehow i can call these tagVariables in my request.

But i have to send the request each time, get the data, append the new response data to the existing response data in my DeviceIDs Global variable, then update the URI with the next TagID, and repeat until out of TagIDs.

Take a look at this tutorial I have created a few years ago. I think it can solve your problem: