How to save the same the same value from response in different variable names in order to use in the next request?

Hello everyone!
I want to use the same property value in different variable names in order to use them in the next request one after another.

Here is my response:
I want to call the same request 3 times one after another, and every time I want to keep the id values as different variables, because every when sending the same request it generates different ids.

{
    "id": 325623669055201,
    "url": "https:/325623669055201.jpg",
    "tags": [
        "#room"
    ],
    "public": true,
    "mature": false,
    "show_edit_history": false,
    "type": "photo",
    "width": 550,
    "height": 301,
    "has_watermark": false,
    "title": "",
    "sources": [],
    "created": "2020-04-26T19:01:09.531Z",
    "location": {},
    "user": {
        "id": 321817103026101,
        "username": "user1234",
        "photo": "https://321817223390201.jpg",
        "name": "Hellen",
        "remix_score": 0
    },
    "status": "success",
    "message": "Photo was successfully uploaded",
    "reason": null
}

This is my test script:

var counter = pm.variables.get('counter');
counter++;
pm.variables.set('counter', counter);

if (counter < 4) {
   postman.setNextRequest('{{url}}/photos/add.json?key={{user_key}}&is_public=1');
} else {
   postman.setNextRequest(null);
}
let jsonDataUploadedPhotoId = pm.response.json();
  pm.globals.set("uploaded_photo_id1", jsonDataUploadedPhotoId.id);
  pm.globals.set("uploaded_photo_id2", jsonDataUploadedPhotoId.id);
  pm.globals.set("uploaded_photo_id3", jsonDataUploadedPhotoId.id);

Problem:

Every time when I send the request, all the variables (uploaded_photo_id1, uploaded_photo_id2, uploaded_photo_id3) get the same value .

But I need to keep different values in these variables as every time it generates new ids.

Thank you in advance for your help

Hi @anna.tirshenko you are getting the value from the response and setting the “id” from one response to all the three variables in your global environment variables. So eventhough you get 3 different values, the id from the 3rd response is saved in all the 3 global variables. Try the below code instead.

var counter = pm.variables.get('counter');
counter++;
pm.variables.set('counter', counter);
if (counter < 4) {
     postman.setNextRequest('{{url}}/photos/add.json?key={{user_key}}&is_public=1');
} else {
     postman.setNextRequest(null);
}
let jsonDataUploadedPhotoId = pm.response.json();
pm.globals.set("uploaded_photo_id" + counter, jsonDataUploadedPhotoId.id);