Skip to content

Create an action rule

POST
/action-rules
curl --request POST \
--url https://example.com/api/v1/action-rules \
--header 'Content-Type: application/json' \
--data '{ "description": "example", "enabled": true, "label": "example", "name": "example", "notification_type": "example", "on": [ "example" ], "opt_out_allowed": true, "targets": [ "example" ], "when": "example" }'

Adds a rule that, on an alarm’s raise or clear, when its predicate holds over the alarm facts, queues one notification per target in the transition’s own transaction, which the server’s tick then delivers. An unknown transition, type or target, or a predicate that does not compile, is a 422; a taken name a 409. Audited. Gated by rule:create, with an all-scope grant: a rule watches the whole fleet.

Media type application/json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
description

What it is for

string
enabled

Whether it fires (default true): a disabled rule queues nothing on a transition, and what it queued before still delivers

boolean
label

A human label

string
name
required

The rule’s name (lowercase kebab)

string
>= 1 characters
notification_type

The notification type to send, by name or uuid; absent sends the official one for the transition

string
on
required

The alarm transitions it fires on: raised, cleared, or both. Acknowledging an alarm is never one

Array<string> | null
>= 1 items
opt_out_allowed

Let a member of a group it targets opt out of it for themselves (default false)

boolean
targets
required

The notification targets to send to, by name or uuid

Array<string> | null
>= 1 items
when

A predicate over the alarm facts at the action expression site (component, location, severity, severity_rank, platform, message, transition, rule, …; see /expressions:validate with site action); absent always holds. A refusal is a 422 with its line and column

string

Created

Media type application/json

A rule that decides when a notification about an alarm is sent, and to which targets.

object
$schema

A URL to the JSON Schema for this object.

string format: uri
created_at
required
string format: date-time
description
string
enabled
required
boolean
id
required

The rule’s uuid, the stable form of name

string
label
string
name
required
string
notification_type

The notification type it sends, by name; absent sends the official one for the transition (alarm-raised, alarm-cleared)

string
notification_type_id

That type’s uuid

string
official
required

Shipped with Omniglass by the boot seed: only its enabled switch, its opt-out allowance and the targets added to it are the operator’s, and it cannot be deleted

boolean
on
required

The alarm transitions it fires on: raised, cleared, or both

Array<string> | null
opt_out_allowed
required

Whether a member of a group it targets may opt out of it for themselves (:optOut); false by default, so an on-call page cannot be opted out of unless an admin allows it

boolean
targets
required

The notification targets it sends to, by name

Array<string> | null
updated_at
required
string format: date-time
when

The predicate over the alarm facts (the action expression site); absent always holds

string

Example

{
"$schema": "/api/v1/schemas/ActionRuleBody.json"
}

Error

Media type application/problem+json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
detail

A human-readable explanation specific to this occurrence of the problem.

string
errors

Optional list of individual error details

Array<object> | null
object
location

Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’

string
message

Error message text

string
value

The value at the given location

instance

A URI reference that identifies the specific occurrence of the problem.

string format: uri
status

HTTP status code

integer format: int64
title

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

string
type

A URI reference to human-readable documentation for the error.

string format: uri
default: about:blank

Example

{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "about:blank"
}