November 7th 2023

New

Multistep API Checks now available in Beta

We are very excited to announce the beta release of Multistep API checks!

Now, you can test and monitor entire user flows by chaining together multiple API requests or test all methods on an endpoint in a single check, all using our web script editor or your IDE of choice.

Why Multistep API checks?

As a fully programmable check type, multistep API checks allow you to mimic real user journeys and actions closely. Change, delete, or add new data between request steps as needed. Unlike traditional multistep solutions, you are not bound to what some form builder allows; it is all done in code you control.

Multistep API checks support the entire Checkly monitoring-as-code workflow from day one; you can integrate existing Playwright API checks today and use our CLI or Terraform provider to run them on Checkly.

Multistep API checks and Browser Checks

While similar to Checkly’s browser checks, multistep API checks provide deep insights into each API request made with a purpose-built result viewer. Multistep checks are also much more affordable, with each request priced at the price of an API check. This allows you to monitor complex user journeys reliably and economically.

Getting started

Similar to browser checks, we use Playwright to power multistep API checks. When creating your first multistep API check, you can choose from one of the existing templates to get started, and if you have existing Playwright API tests, you can now use those to monitor your product.

To provide clear and actionable information, multistep checks rely on the test.step method. When writing a multistep check, we recommend having a test step with a descriptive label for each request required and any assertions related to the request inside the same test step. Here is a simple example.

import { test, expect } from '@playwright/test'

const baseUrl = 'https://api.myproduct.com/v1'

test('My test', async ({request}) => {
    await test.step('First step', async () => {
        const health = await request.get(`${baseUrl}/health`)
        expect(health).toBeOK()
        await expect(response).toBeOK()
    });

    await test.step('Second step', async () => {
        const response = await request.post(`${baseUrl}/health`)
        // Assertions for the second step
        ...
    })
})

When building a new multistep check using our web editor, you can use the test result information in the side panel to view error information, request results, and assertion details. Simply click on any request node to get the full result.

The request result and assertion details are also available in the check result view:

Multistep checks support all Checkly alerting channels, including custom webhooks. The new check type also supports test sessions, dashboards, maintenance windows, and more.

Using the Checkly CLI or Terraform

This first release of multistep API checks includes full support for the Checkly CLI and our Terraform provider, allowing you to include multistep checks in your MaC workflow from day one. The MultistepCheck construct is available in Checkly CLI v4.3.0

import { MultiStepCheck } from 'checkly/constructs'

new MultiStepCheck('multistep-check-1', {
  name: 'Multistep Check #1',
  runtimeId: '2023.09',
  frequency: Frequency.EVERY_10M,
  locations: ['us-east-1', 'eu-west-1'],
  code: {
    entrypoint: path.join(__dirname, 'home.spec.ts')
  },
})

Additional resources

We look forward to hearing what you think of the latest addition to Checkly!

Multistep API checks are available on all Checkly plans. Each request in a multistep API check counts as a single API check for billing purposes.

Type @ to mention posts