Compatibility: create or replace the first rule

Creates the set's first rule when it is empty, otherwise replaces the document of the rule at position 0 (a new version). Other rules in the set are untouched. The body is the rule document itself.

PUT
/api/v1/endpoints/{endpointId}/transformation
AuthorizationBearer <token>

API key in the Authorization header: Authorization: Bearer wv_live_…. Keys are created on the API keys page in the app, shown once, and scoped to your workspace. A key acts for the person who created it: each call needs the operation's scope (x-wv-scope) and is limited to what that person's role allows now. X-Api-Key: wv_live_… is accepted as a fallback for tools that can't set Authorization.

In: header

Path Parameters

endpointId*string

The endpoint id (also the capture token in its URL).

Formatuuid

Query Parameters

dryRun?boolean

true runs the operation and then undoes it: nothing is stored, sent or queued. A call that would be refused answers exactly as it would without dryRun; one that would succeed answers 200 with dryRun, the status it would have returned, a plain-language summary of what it would do, and the result it would have returned. A dry run never needs approval.

Defaultfalse

Header Parameters

Approval-Id?string

The approval a 202 approval_required answer gave. Send exactly the same request again (method, path, query and body) with this header once the person has approved: it runs once. Refusals: 404 approval_not_found, 409 approval_pending, approval_declined, approval_expired or approval_used, 422 approval_mismatch (a different request), 412 version_mismatch (the target changed after the approval was asked), 409 reach_changed (the change now reaches more than the person approved).

Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

{
  "ruleId": "70af3071-65d9-4ec3-b3cb-5283e8d55dac",
  "ruleCount": 0,
  "endpointId": "c8d2c7e1-e4b1-4108-9e29-3429a36a1ef3",
  "destinationId": "d0a0ebc7-d6b4-4f3c-a5af-5761a8148e3a",
  "destinationUrl": "string",
  "rule": {
    "version": 1,
    "name": "strip PII, flatten invoice",
    "when": {
      "all": [
        {
          "path": "body.type",
          "op": "startsWith",
          "value": "invoice."
        }
      ]
    },
    "steps": [
      {
        "op": "keep",
        "paths": [
          "body.id",
          "body.type",
          "body.data.object"
        ]
      },
      {
        "op": "rename",
        "from": "body.data.object.id",
        "to": "body.invoiceId"
      },
      {
        "op": "redact",
        "paths": [
          "body.data.object.customer_email"
        ],
        "with": "***"
      },
      {
        "op": "set",
        "path": "headers.X-Relayed-By",
        "value": "webhookvault"
      },
      {
        "op": "template",
        "path": "body.summary",
        "template": "{{body.type}} {{body.invoiceId}}"
      }
    ]
  },
  "version": 0,
  "updatedAt": "2019-08-24T14:15:22Z",
  "featureInPlan": true,
  "schemaUrl": "string"
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "traceId": "string"
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "traceId": "string"
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "traceId": "string"
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "traceId": "string"
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "traceId": "string"
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "code": "string",
  "traceId": "string"
}

On this page