Data cascading in POSTMAN

Data cascading in POSTMAN is nothing, but passing data from one response of a request to another API.

This is done when one API test is dependent on the response data of another API.

Suppose there is one API that lists all the country details and there is another API that just retrieves all the country names.

Data cascading in API testing is also useful when there are different APIs which independent of each other. Data cascading can be done in different ways- single-level cascading and multi-level cascading and multiple cascading.

  • In the Single level cascading data from one API response can is referred to another API.
  • In the Multiple cascading the data from one API response can is referred to many other APIs.
  • In the Multi-level cascading the data from one API response is referred to another API and then then the data from the next APIs is again used in a third API and so on.
In this article, we shall discuss only about Single Level Cascading.

Single Level Cascading

It is possible to get the data from one response of an API and fetch the same data into a different API. Now, let us see how you can do it.

First of all, you have to create two different requests. I shall use the same collection, and inside it, I shall create two API requests. One is the GET type and the other is a POST type. The way to create the API request is the same. Visit the same link- And select the requests.

For the first API request, select the GET: List User. Then copy the URL and also the request endpoint and then create the request. (This is your first request).


Now, paste it into the URL bar of the first request and create your first request and name it. I have named it as: list-user.

Now, create the second request. Visit the link: And then select the PUT: Update.


Copy the URL and the request end-point and paste it into the URL bar of your second request. I have named it as: update-user.

Now, you have created both the requests.


Now, the next step is to parameterize the value in the body section of the request. Go to the second request (update user) and navigate to the body section and then select the raw. Then select a field and replace it with a variable.

So, my original content of the body was:

    "name": "morpheus",
    "job": "zion resident"

And now I have to change the morpheus into username01.

    "name": "{{username01}}",
    "job": "zion resident"

Now, the username01 is a variable and has to be updated as a global variable or environment variable. I shall select the environment variable.

To set an environment variable, go to the Manage environment (gear icon) in the top-right corner of the POSTMAN interface or create a new environment by clicking on the New button.


Now, click on the send button and see the output. As you can see below, the name which morpheus earlier is now changed to rahul


Fetching data from API Response

Now, to fetch the data from the API response, navigate to the first API response. And go the Tests option. And edit the below code there:

bodyData = JSON.parse(responseBody)
value =[3].first_name

The data[3].first_name is the path of the first name. So, to get the path, visit: and then paste the response test into the editor of the website and then navigate into the right-side of the same page to get the path:


Now, paste it into the json Path finder.


Now, click into data, of the attributes and the corresponding path will be available above in the path bar. Then copy the path.


Now, also you can set variables as Global Variables. As there are different snippets available into the POSTMAN interface itself, you can use it simply and write the code for Global Variable.


Now edit the below code into the Text section of your second API request:

bodyData = JSON.parse(responseBody)
value =[3].first_name
pm.environment.set("username01", value);

After that, save it, and click on the send button. And now check into your current environment, whether the variable has automatically taken the value:


So, in the above image, it is visible that the variable username01 has been initialized with the value Byron. And so the current value is also the same for the variable.

Create both the request in the same environment, and try to execute the same under the same environment.
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions

Subscribe to See Videos

Subscribe to my Youtube channel for new videos : Subscribe Now