Use a request multiple times and inject data from another request in Postman
In terms of data-driven testing, Postman allows you to load a CSV or a JSON file with test data. But sometimes that data set comes from an API. In this Postman tutorial, I wanted to show you how to reuse a request and loop over a set of data from a previous request.
Published in
4 min readNov 24, 2021
The problem
Let’ take a look at the following POST request in Postman.
As you can see, both the customerName
and the toolId
used in this request are hardcoded.
Let’s now assume that we want to test this endpoint using a set of tools, and to get valid data, we can’t use a hardcoded list. We need to fetch a list from another API.
There is an example:
Creating the dynamic data set
The next step would be to parse the response and to create a Postman variable to hold the list of ids.