Automatically trigger new request based on responose

380 views Asked by At

I have API request which gives data and a link to the next page. I want postman to use this link as my next API request without my input.

1

There are 1 answers

0
Derryl Thomas On

You can do this by adding some code in the Tests section of the postman request. First, parse the response received after your first request using - var jsonData = JSON.parse(responseBody);

Now extract the link you want to use for your next call from jsonData and then make your next request using pm.sendRequest().

Refer https://blog.getpostman.com/2014/01/27/extracting-data-from-responses-and-chaining-requests/ and https://blog.getpostman.com/2017/10/03/send-asynchronous-requests-with-postmans-pm-api/ for more info.