Request chaining using multi-step requests

The Multi-step Requests feature (request chaining) is available on all Testfully plans, including the Free plan.

Multi-step Request is one of Testfully's unique API Client features. It allows our users to chain multiple HTTP requests together, send them serially and read values from one request and use it within other requests.

This tutorial takes you through the following items:

Create a multi-step request

Let's start by creating a request with two steps:

  1. Open the API Client UI and add a new request; set the URL to https://httpbin.org/anything.
  2. Click on the + New Step button to add a new step to your request. Set the URL of new the step to https://httpbin.org/status/200.
  3. Click on the Send button to send the steps.
  4. The response widget opens up for you; it should have two steps called Step 1, and Step 2.

Congratulations! You have created your first multi-step request.

Read values from one step and use them within other steps

Steps of a multi-step request can read and use values from any of the preceding steps in the chain; this includes reading values from request headers, request body, response body, and response headers.

To read values of other steps, use the {{step()}} Testfully Function. To learn more, click here.

  1. If it's not already open, please open the API Client UI.
  2. Add a new request to your workspace; set the URL to https://httpbin.org/anything and click on the Send button to verify it all works. You should get 200 OK from HTTPBin API.
  3. The response has a field called X-Amzn-Trace-Id; let's read the value of the X-Amzn-Trace-Id field and use it in the second step of this request.
  4. Click on the "+ Add Step" button; set the URL to https://httpbin.org/anything.
  5. Click on the Headers tab of the second step; enter "x_trace_id" as the name; in the Value field enter {{step(index:0, segment:response_body, path:headers.X-Amzn-Trace-Id)}}.
  6. Let's verify that the value is correctly read and used.
    • In the response widget, scroll down to the second step; then click on the "Request" tab 2.
    • You should see the x_trace_id header; the value is identical to the returned value from the first step.

Usecases for multi-step requests and request chaining

To give you an idea of how this feature can be used, we have listed a few popular use cases:

  • To acquire a fresh access token; for example, you could authenticate in one step and read the access token (available via response body) in other steps.

  • To do clean-up tasks; for example, you could add a new product, read the "productId", and delete the product via a second request.