I have a query.
Here is the output of GET Request:
{
"results": [
{
"_create_time": 1593660567827,
"_last_modified_user": "admin",
"_revision": 2,
"ip_addresses": [
"197.236.36.77",
"14.194.131.10",
"103.143.78.165",
"159.118.72.37"
],
"_system_owned": false,
"resource_type": "IPSet",
"_protection": "NOT_PROTECTED",
"_last_modified_time": 1593660828504,
"id": "8b46b08d-9b78-40d4-8679-519c236d1847",
"display_name": "Chief",
"_create_user": "admin"
},
{
"_create_time": 1593657340963,
"_last_modified_user": "admin",
"_revision": 0,
"ip_addresses": [
"128.227.32.51",
"197.232.233.138",
"251.232.157.118",
"38.148.109.60"
],
"_system_owned": false,
"resource_type": "IPSet",
"_protection": "NOT_PROTECTED",
"_last_modified_time": 1593657340963,
"id": "59ab6d23-74aa-413b-8d8e-09e387ba252e",
"display_name": "hub",
"_create_user": "admin"
},
{
"_create_time": 1593660570241,
"_last_modified_user": "admin",
"_revision": 0,
"ip_addresses": [
"250.203.244.142",
"232.37.130.233",
"18.214.175.217",
"20.43.199.165"
],
"_system_owned": false,
"resource_type": "IPSet",
"_protection": "NOT_PROTECTED",
"_last_modified_time": 1593660570241,
"id": "dc7bc648-fe98-4ff2-b00b-d432a9945085",
"display_name": "Incredible Fresh Keyboard",
"_create_user": "admin"
},
{
"_create_time": 1593657344034,
"_last_modified_user": "admin",
"_revision": 0,
"ip_addresses": [
"209.66.94.219",
"195.111.110.233",
"155.212.95.163",
"98.142.37.181"
],
"_system_owned": false,
"resource_type": "IPSet"
"_protection": "NOT_PROTECTED",
"_last_modified_time": 1593657344034,
"id": "c3bea23b-6cbf-4ec2-80e7-d0a84c5bb072",
"display_name": "neural-net",
"_create_user": "admin"
},
{
"_create_time": 1593657185985,
"_last_modified_user": "admin",
"_revision": 0,
"ip_addresses": [
"12.241.214.18",
"32.140.244.205",
"171.209.16.35",
"153.248.34.20"
],
"_system_owned": false,
"resource_type": "IPSet",
"_protection": "NOT_PROTECTED",
"_last_modified_time": 1593657185985,
"id": "4686878b-d363-48c7-965f-f495f27387cf",
"display_name": "Technician",
"_create_user": "admin"
}
],
"result_count": 5,
"cursor": "5"
}
I have picked all the values of id and revision into an array using this.
let jsonData = pm.response.json()
let ids = []
let revs= []
_.each(jsonData.results, (result) => {
ids.push(result.id)
revs.push(result._revision)
})
pm.globals.set('ids', JSON.stringify(ids))
pm.globals.set('revs', JSON.stringify(revs))
Now for each element in Ids, I want to run a PUT API.
The id has to be in the PUT URL, not in body.
the corresponding element in rev Array has to be part of Body of PUT API.