This endpoint is used to obtain an Access Token using the Client Credentials Grant flow. This flow is typically used for machine-to-machine (M2M) communication where a specific user’s consent is not required, and the client application is acting on its own behalf.

Create webhook

This endpoint registers a new webhook subscription for a specific namespace. By creating a webhook, your system can receive real-time HTTP callbacks (POST requests) whenever a specific action (e.g., creation) occurs on a specific resource type (e.g., case) within that namespace.

Request specification

Method: POST (Implied by the presence of a JSON payload)

URL: http://localhost:8080/apis/v1/namespaces/{namespace}/webhook

Path parameters

ParameterTypeRequiredDescription
namespaceStringYesThe unique identifier of the namespace where the webhook will be registered (e.g., 142033).

Headers

HeaderValueRequiredDescription
AuthorizationBearer <TOKEN>YesA valid OAuth2 or API Bearer token for authentication.
Content-Typeapplication/jsonYesIndicates that the request body is formatted as JSON.

Body parameters

The request body defines the configuration of the webhook subscription.

FieldTypeRequiredDescription
kindStringYesThe type of resource being created. Must be set to "webhook".
versionStringYesThe API version for the webhook definition (e.g., "v1").
namespaceStringYesThe namespace ID. This usually matches the path parameter.
nameStringYesA unique, user-defined name for this specific webhook configuration (e.g., "case-v1alpha-create").
metadataObjectNoA key-value map for optional custom data or labels.
specObjectYesThe specification object detailing the trigger conditions and destination.
urlStringYesThe destination URL (endpoint) where the event payload will be sent.
versionStringYesThe version of the resource you want to monitor (e.g., "v1alpha").
kindStringYesThe specific resource type to monitor (e.g., "case").
actionStringYesThe specific lifecycle event that triggers the webhook (e.g., "create", "update", "delete").

Example usage

Request

curl --location --request POST 'http://localhost:8080/apis/v1/namespaces/142033/webhook' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <YOUR_ACCESS_TOKEN>' \
--data '{
    "kind": "webhook",
    "version": "v1",
    "namespace": "2135",
    "name": "case-v1alpha-create",
    "metadata": {},
    "spec": {
        "url": "https://eojn4d67eio97gx.m.pipedream.net",
        "version": "v1alpha",
        "kind": "case",
        "action": "create"
    }
}'

Trigger logic

Based on the example payload provided:

  • Trigger: A new "case" resource (version v1alpha) is created.
  • Action: The system sends a POST request containing the event details to https://eojn4d67eio97gx.m.pipedream.net.