Integration

TypeScript- / JavaScript-SDK @pathly/sdk

Offizieller npm-Client: Szenarien, Paginierung, Idempotency-Key und Retry-After.

OpenAPI-VertragAPI-Schlüssel ausstellenKostenloses Solo-Konto

Vollständiges Dokument, ohne Authentifizierung, bereit für Ihren Client-Generator.

TypeScript- / JavaScript-SDK

npm-Paket @pathly/sdk (Monorepo, createChain für eine Chain). Leichter HTTP-Client. Das Paket pathly-sdk 0.1 akzeptiert httpChain auf createScenario, ohne Helper.

PATHLY_API_TOKEN an den PathlyClient-Konstruktor übergeben. Basis-URL: https://api.pathlyhq.com.

Installieren, Ping und Chain

npm i @pathly/sdk
export PATHLY_API_TOKEN=sp_…

import { PathlyClient } from "@pathly/sdk";

const client = new PathlyClient({ token: process.env.PATHLY_API_TOKEN });
const ping = await client.createScenario({
  name: "Checkout",
  url: "https://www.example.com/cart",
  intervalSec: 300,
  expectText: "Your cart",
});
const chain = await client.createChain({
  name: "Login then /me",
  intervalSec: 300,
  hops: [
    { name: "Login", method: "POST", url: "https://api.example.com/login", assertStatus: 200 },
    { name: "Me", method: "GET", url: "https://api.example.com/me", assertStatus: 200 },
  ],
});
console.log(ping.id, chain.id);

Mit Paginierung listen

for await (const row of client.paginate((cursor) => client.listScenarios({ cursor }))) {
  console.log(row.id, row.name);
}

ESM one-liner (CI)

node --input-type=module -e "import { PathlyClient } from '@pathly/sdk'; const c=new PathlyClient({ token: process.env.PATHLY_API_TOKEN }); console.log(await c.listScenarios());"