Hi together,
I’m new here an I got a respons which I want to pass into another Call. Now I struggle because I need to remove the “” from the id, otherwise I can’t pass the variable into my other Call.
This is my response so far:
HI @w4dd325 ,
where would I put the slice into my code? Into the code where my variable should be or in the code where I get my variable? Sry for asking, I’m completly new to this topic
Ok I can remove the “” If I use the enviroment variable…but now I would like to put the result which is in my case 2 values comma seperated into my POST call - I can’t put them both into the Call I have to put them seperatly into it. Can someone help?
Hi @w4dd325 ,
the values should be splitted into single IDs. I created a collection to use interations but I’m still struggeling with the single values instead of comma separated values.
You would probably be better to save the values as an array then.
//Parse response
const response = pm.response.json();
//Setup array
myArray = [];
//Loop all items you need to save
for (i = 0; i < response.length; i++)
{
//Use "Push" to add each item to your array
myArray.push(response[i].name);
}
//Display the whole array
console.log(myArray);
//Pick a specific item from the array
console.log(myArray[4]);
console.log(myArray[42]);
console.log(myArray[57]);