If I understand you correctly, you want to run the same request multiple times, and grab a unique value and save it to a new variable each time the request is run?
You could do something like this:
let iterationCount = pm.collectionVariables.get('iterationCount');
if(iterationCount) {
iterationCount = Number(iterationCount);
}
else {
iterationCount = 1;
}
const jsonData = pm.response.json();
const value = jsonData.value; // this would be whatever your property you want
let values = pm.collectionVariables.get('values');
if(values) {
values = JSON.parse(values);
}
else {
values = [];
}
values.push(value);
pm.collectionVariables.set('values', JSON.stringify(values));
iterationCount++;
if(iterationCount <= 5) { // This would be your threshold for how many times to loop
pm.collectionVariables.set('iterationCount', iterationCount);
postman.setNextRequest('Name of this request');
}
else {
pm.collectionVariables.unset('iterationCount');
}