CentralCSP
APIAlerts

Update an alert rule

Changes a rule's name, cooldown, channels, or enabled state. Sending channelIds replaces the whole set. The event type cannot be changed, so create another rule instead.

Requires the manager role on the website and the alerting plan feature.

PATCH
/v1/workspaces/{workspaceId}/websites/{websiteId}/alerts/rules/{ruleId}

Authorization

AuthorizationBearer <token>

An OpenID Connect access token issued by Keycloak, acting as the signed-in user.

In: header

Path Parameters

workspaceId*string
websiteId*string
ruleId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

name?string

New display name.

Length1 <= length <= 255
cooldownSeconds?|

How long to collect findings before sending, up to 24 hours. Everything found in that time arrives as one notification. Defaults to 900 seconds.

Range0 <= value <= 86400
config?|

Replace the spike thresholds, or send null to go back to the defaults. Only valid on *:spike rules.

channelIds?array<string>

Channels to notify. They must belong to this website. An empty list means the rule detects but notifies nobody.

Itemsitems <= 20
enabled?boolean

Turn the rule on or off.

Response Body

application/json

curl -X PATCH "https://api-next.centralcsp.com/v1/workspaces/string/websites/string/alerts/rules/string" \  -H "Content-Type: application/json" \  -d '{}'
{  "id": "string",  "workspaceId": "string",  "websiteId": "string",  "name": "New third-party script",  "eventType": "csp-violation:new-type",  "cooldownSeconds": 0,  "config": {    "multiplier": 3,    "floor": 50  },  "enabled": true,  "channelIds": [    "string"  ],  "createdAt": "2019-08-24T14:15:22Z",  "updatedAt": "2019-08-24T14:15:22Z"}