Intégration
Client npm officiel : créer des scénarios, paginer, Idempotency-Key et Retry-After.
Contrat OpenAPIÉmettre une clé d’APICompte Solo gratuit
Obtenir ma clé API (inscription gratuite)
Document complet, sans authentification, à donner à votre générateur de client.
Package npm @pathly/sdk (monorepo, createChain pour une Chain). Client HTTP sans dépendance runtime lourde : Idempotency-Key, Retry-After, pagination par curseur. Le paquet npm pathly-sdk 0.1 accepte httpChain sur createScenario, sans helper.
Passez PATHLY_API_TOKEN au constructeur PathlyClient. Base URL par défaut : https://api.pathlyhq.com. Pour un smoke post-deploy, combinez ce SDK avec l’Action GitHub (run-scenario) ou un job curl sur /v1.
Installer, Ping et 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);Lister avec pagination
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());"