Skip to main content

Documentation Index

Fetch the complete documentation index at: https://intunedhq.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Recipe

This recipe shows how to extract data directly from API responses by intercepting network requests. Use Playwright’s response listener with withNetworkSettledWait (TypeScript) or wait_for_network_settled (Python).
TypeScript
import { BrowserContext, Page, Response } from "playwright";
import { withNetworkSettledWait } from "@intuned/browser";

let apiData: any[] = [];

async function handleResponse(response: Response): Promise<void> {
  if (response.url().includes("/rest/v1/consultations")) {
    try {
      apiData = await response.json();
    } catch (e) {
      // Response might not be JSON
    }
  }
}

export default async function handler(
  params: any,
  page: Page,
  context: BrowserContext
) {
  apiData = [];

  // Listen for responses matching the pattern
  page.on("response", handleResponse);

  // Wait until the page is fully loaded and in the idle state
  await withNetworkSettledWait(
    async (page) => {
      await page.goto('https://sandbox.intuned.dev/consultations/list');
    },
    {
      page,
      timeoutInMs: 20000,
    }
  );
  console.log(`Captured ${apiData.length} consultations from API`);
  return apiData;
}

How it works

  1. Set up response listener — Use page.on("response", handler) to listen for network responses.
  2. Filter by URL — Check if the response URL matches your target API endpoint.
  3. Capture the data — Parse the JSON response and store it.
  4. Navigate to the page — The listener captures API calls triggered during page load.

withNetworkSettledWait (TypeScript)

Wait for network to settle (TypeScript)

wait_for_network_settled (Python)

Wait for network to settle (Python)

Cookbook (Python)

Python network interception example in the Intuned Cookbook

Cookbook (TypeScript)

TypeScript network interception example in the Intuned Cookbook