v1

latestOpenAPI 3.1.02026-07-1324323188.8 KB
Rule

Updates an existing Rule

Use this endpoint to update an existing rule.

💡 Please note that the rule will actually be updated on your website only once you publish the ruleset.

put/rules/{id}

Path parameters

idstring required

Rule identifier

Request body

descriptionstring nullable

This description field is used to describe the rule and share knowledge with other users

enabledboolean

Set to false to disable this rule

metadataobject
priorityinteger

A rule with higher priority takes precedence over lower priorities, which means that the actions defined in the higher priority rule will override the similar actions defined in a lower priority one

projectstring iri-reference required

An IRI reference to the project, of the form /projects/{project_id}.

tagsstring[]

Tags are useful to filter rules and retrieve them easily

Example request

{
  "actions": [
    {
      "mode": "default"
    }
  ],
  "markers": [
    {
      "description": "My enum marker that only allow \"dog\" or \"cat\"",
      "name": "MyEnum",
      "transformers": [
        {
          "something": "foo",
          "with": "bar"
        }
      ]
    }
  ],
  "project": "/projects/{projectID}",
  "trigger": {
    "date": [
      {
        "operator": "equals"
      }
    ],
    "datetime": [
      {
        "operator": "after"
      }
    ],
    "ipAddress": {
      "ip": "1.2.3.4"
    },
    "methods": [
      "GET",
      "POST"
    ],
    "requestHeaders": [
      {
        "name": "Accept",
        "operator": "isNotEqualTo",
        "value": "application/json"
      }
    ],
    "responseStatusCodes": [
      500,
      503
    ],
    "sampling": 47,
    "source": "/old-url",
    "time": [
      {
        "operator": "after"
      }
    ]
  },
  "variables": [
    {
      "marker": "markerName",
      "name": "myVariable",
      "transformers": [
        {
          "something": "foo",
          "with": "bar"
        }
      ]
    }
  ]
}

Response

Draft rule resource updated (with the status update)

idstring required
status'add' | 'update' | 'delete' required

The type of change that this draft represents.

Example response

{
  "rule": {
    "actions": [
      {
        "mode": "default"
      }
    ],
    "markers": [
      {
        "description": "My enum marker that only allow \"dog\" or \"cat\"",
        "name": "MyEnum",
        "transformers": [
          {
            "something": "foo",
            "with": "bar"
          }
        ]
      }
    ],
    "trigger": {
      "date": [
        {
          "operator": "equals"
        }
      ],
      "datetime": [
        {
          "operator": "after"
        }
      ],
      "ipAddress": {
        "ip": "1.2.3.4"
      },
      "methods": [
        "GET",
        "POST"
      ],
      "requestHeaders": [
        {
          "name": "Accept",
          "operator": "isNotEqualTo",
          "value": "application/json"
        }
      ],
      "responseStatusCodes": [
        500,
        503
      ],
      "sampling": 47,
      "source": "/old-url",
      "time": [
        {
          "operator": "after"
        }
      ]
    },
    "variables": [
      {
        "marker": "markerName",
        "name": "myVariable",
        "transformers": [
          {
            "something": "foo",
            "with": "bar"
          }
        ]
      }
    ]
  },
  "status": "add"
}