I’d like to save the “UniqueId” for each object then store all of these individually in globals with different names. So, in the next request I can refer to each of these and check details of each product. How do I do this?
Here is a code sample that gets the JSON response, loops through the array, and for for ever “carrier object” gets the UniqueID.
let jsonData = pm.response.json();
var i = 0;
//for each object in the array
jsonData.carriers.forEach(function(entry) {
console.log(i + ' ' + entry.UniqueId);
//get the varable value
var uniqueId_val = entry.UniqueId
pm.globals.set(i, uniqueId_val);
i++;
});
Do you know if theres a way to then refer to each of these saved globals in another request that will just run through and hit all the uniqueids one after the other without needing to create multiple requests?