create or update webhook rule.md

Create or Update Webhook Rule

Management API · Webhook Rules

PUT https://app.mk.io/api/v1/projects/{project_name}/webhook/rules/{rule_name}

Create or Update Webhook Rule.

RBAC Capability Required: webhooks.config.create or webhooks.config.update

Authentication

Path parameters

Name Type Required Description
project_name string Yes
rule_name string Yes

Request body

Content type: application/json

Example request

curl -X PUT "https://app.mk.io/api/v1/projects/{project_name}/webhook/rules/{rule_name}" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
  "spec": {
    "authentication": {
      "headers": {
        "key": "string"
      },
      "queryParams": {
        "key": "string"
      }
    },
    "enabled": true,
    "events": [
      "MediaKind.JobStarted"
    ],
    "headers": {
      "key": "string"
    },
    "queryParams": {
      "key": "string"
    },
    "url": "string"
  }
}'

Responses

200 — Webhook Rule was updated

Example:

{
  "metadata": {
    "id": "00000000-0000-0000-0000-000000000000",
    "name": "string"
  },
  "spec": {
    "authentication": {
      "headers": {
        "key": "string"
      },
      "queryParams": {
        "key": "string"
      }
    },
    "enabled": true,
    "events": [
      "MediaKind.JobStarted"
    ],
    "headers": {
      "key": "string"
    },
    "queryParams": {
      "key": "string"
    },
    "url": "string"
  }
}

201 — Webhook Rule was created

Example:

400 — Bad Request

Example:

{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}

401 — Unauthorized

Example:

{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}

403 — Forbidden

Example:

{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}

404 — Not Found

Example:

{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}

429 — Too Many Requests

Example:

{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}

500 — Internal Server Error

Example:

{
  "error": {
    "code": "string",
    "detail": "string",
    "extraDetail": {
      "key": null
    }
  },
  "ref": "string",
  "status": 0
}