Delete users in bulk

My question:
I need to delete users in bulk, but I am not able to do it as my isntance is able to delete one user at a time.
For example :
In order to delete a user I need to make a call DELETE /users/{userid} where the userid is coming from
GET /users?

Which I need to put one by one in DELETE /users/{userid}
Can I automate this so the userid is passed automatically to every next DELETE request?

Details (like screenshots):

Screen Shot 2021-07-10 at 2.16.37 PM

Hi @vpredola, Welcome to the Community!

There could be multiple ways to achieve this. It’s all up to you how you can go ahead. Two ways which I can think of are below.

  • Once you hit a get request, you will be getting multiple user IDs in response, which you want to delete. So, you can iterate over each in the test script and send a DELETE request from the test script for each userID using pm.sendRequest().
  • Another way could be to create a .csv file of response from a get request and use the collection runner to iterate for each of the user IDs. That collection will contain only one request

DELETE /users/{userid}

and {userid} will be picked from .csv file

Hope this helps :slight_smile: