first i get Ids i wanna delete
second what i should do to delete all this data ?
delete request just can delete on recorder and i wanna delete array have this ids
first i get Ids i wanna delete
second what i should do to delete all this data ?
delete request just can delete on recorder and i wanna delete array have this ids
There are easier ways to produce an array of ID’s from your response using the JavaScript map function.
const response = pm.response.json()
let IDs = response.map(item => item.id); // create a new flat array of just the IDs
console.log(IDs);
We can’t tell you how to delete the records, as you have provided no information on what the delete request should look like.
I assume you need to send a request to a slightly different end point that surfaces your delete operation using the data from the current record in the array\response.
A quick way to do this is to use the sendRequest() functionality in Postman.
You don’t really need to create an array for this. You are already looping through the response, but instead of pushing the current ID to a new array, use the sendRequest() function to call your DELETE api instead with whatever it needs from the current response to make it work.