How to hit update service multiple time with different data

How to hit update service multiple time with different data set, Data set needs to be taken from the response of search API.
(First i need to hit search API, response of search API contains multiple records. now I want to hit Update API for all the records, in update request I need to pass record ID and some other data from the response of search API)

Hi @pkprakash. Welcome to the Postman Community!

There are multiple ways to achieve this.

When you make the API request to the search API endpoint. In the scripts tab of that API, you can create a loop that iterates over the response items, and in each loop, make a new API request using pm.sendRequests.

Alternatively, you can create two requests in your Collection. One for searching, and another for updating. These requests will run sequentially when you run them using the collection runner. Follow these steps:

  • Store the data from the search API in a variable
  • use pm.setNextRequest to loop over this request.
  • Update the variable that contains the search results on each iteration of this loop.
  • Add a condition to exit the loop using pm.setNextRequest(null)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.