Skip to main content
REST client

Webhook Endpoints

The 10 operations under webhook-endpoints, as typed calls on the generated REST client.

1 min read
View MarkdownEdit on GitHub

Webhook Endpoints

Available from @codespar/sdk 0.12.0, which is not on npm yet. The published version today is 0.11.0, and it has no cs.api; 0.12.0 is on the main branch of codespar-core. The examples below are not compiled against the installed package for that reason.

Every call below is cs.api reaching one operation of the OpenAPI document this page was generated from; the REST client overview explains request, response, the option bag and the errors. The values are placeholders shaped by the document.

import { CodeSpar } from "@codespar/sdk";

const cs = new CodeSpar({ apiKey: process.env.CODESPAR_API_KEY });

GET /v1/webhook-endpoints

GET/v1/webhook-endpoints

List triggers

const result = await cs.api.get("/v1/webhook-endpoints");

Parameters, body and every documented response: GET /v1/webhook-endpoints in the HTTP reference.

POST /v1/webhook-endpoints

POST/v1/webhook-endpoints

Subscribe a webhook to an event

const result = await cs.api.post("/v1/webhook-endpoints", {
  body: {
    name: "Example",
    event: "string",
    server_id: "srv_0000000000000000",
    webhook_url: "https://example.com/hook"
  }
});

Parameters, body and every documented response: POST /v1/webhook-endpoints in the HTTP reference.

POST /v1/webhook-endpoints/deliveries/{delivery_id}/redeliver

POST/v1/webhook-endpoints/deliveries/{delivery_id}/redeliver

Queue a delivery to be sent again

const result = await cs.api.post("/v1/webhook-endpoints/deliveries/{delivery_id}/redeliver", {
  path: {
    delivery_id: "delivery_0000000000000000"
  }
});

Parameters, body and every documented response: POST /v1/webhook-endpoints/deliveries/{delivery_id}/redeliver in the HTTP reference.

POST /v1/webhook-endpoints/retry-pending

POST/v1/webhook-endpoints/retry-pending

Drain the retry queue for this project

const result = await cs.api.post("/v1/webhook-endpoints/retry-pending");

Parameters, body and every documented response: POST /v1/webhook-endpoints/retry-pending in the HTTP reference.

GET /v1/webhook-endpoints/{id}

GET/v1/webhook-endpoints/{id}

Read one webhook endpoint

const result = await cs.api.get("/v1/webhook-endpoints/{id}", {
  path: {
    id: "webhookendpoint_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/webhook-endpoints/{id} in the HTTP reference.

DELETE /v1/webhook-endpoints/{id}

DELETE/v1/webhook-endpoints/{id}

Delete a webhook endpoint

const result = await cs.api.delete("/v1/webhook-endpoints/{id}", {
  path: {
    id: "webhookendpoint_0000000000000000"
  }
});

Parameters, body and every documented response: DELETE /v1/webhook-endpoints/{id} in the HTTP reference.

GET /v1/webhook-endpoints/{id}/deliveries

GET/v1/webhook-endpoints/{id}/deliveries

List recent delivery attempts

const result = await cs.api.get("/v1/webhook-endpoints/{id}/deliveries", {
  path: {
    id: "webhookendpoint_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/webhook-endpoints/{id}/deliveries in the HTTP reference.

GET /v1/webhook-endpoints/{id}/deliveries/{delivery_id}

GET/v1/webhook-endpoints/{id}/deliveries/{delivery_id}

Inspect one delivery attempt

const result = await cs.api.get("/v1/webhook-endpoints/{id}/deliveries/{delivery_id}", {
  path: {
    id: "webhookendpoint_0000000000000000",
    delivery_id: "delivery_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/webhook-endpoints/{id}/deliveries/{delivery_id} in the HTTP reference.

GET /v1/webhook-endpoints/{id}/dlq

GET/v1/webhook-endpoints/{id}/dlq

List dead lettered deliveries

const result = await cs.api.get("/v1/webhook-endpoints/{id}/dlq", {
  path: {
    id: "webhookendpoint_0000000000000000"
  }
});

Parameters, body and every documented response: GET /v1/webhook-endpoints/{id}/dlq in the HTTP reference.

POST /v1/webhook-endpoints/{id}/rotate-secret

POST/v1/webhook-endpoints/{id}/rotate-secret

Mint a new signing secret for a webhook endpoint

const result = await cs.api.post("/v1/webhook-endpoints/{id}/rotate-secret", {
  path: {
    id: "webhookendpoint_0000000000000000"
  }
});

Parameters, body and every documented response: POST /v1/webhook-endpoints/{id}/rotate-secret in the HTTP reference.

Webhook Endpoints | CodeSpar