What is API Chaining in Postman?

HOME

What is API Chaining?

The API chaining method is to create a sequence of API calls where the output of one API request is used as the input for the next. The technique is an automated and efficient way of executing a Multistep Process.

We will learn to get a response from one API and pass it as a request parameter in another API.

How to create a Collection?

Step 1: Create a Collection, click on Collections, and then click on the “+” plus button.

Add 2 requests in the Postman

https://reqres.in/api/users?page=1

https://reqres.in/api/users/4
{
    "name": "Test",
    "job": "zion resident"
}

pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

var jsonData = pm.response.json();
value = jsonData.data[2].first_name
console.log(value)

pm.environment.set("Username", value);

pm.test("Status code is 200", function () {
    pm.response.to.have.status(200);
});

Leave a comment