Skip to content

Preview a notification type against an alarm

POST
/notification-types/{name}:preview
curl --request POST \
--url https://example.com/api/v1/notification-types/example:preview \
--header 'Content-Type: application/json' \
--data '{ "alarm": "example", "component": "example", "subject": "example", "text": "example", "transition": "raised" }'

Renders the type’s subject and text (or a draft of either, sent in the body) against one real alarm, exactly as a delivery of that alarm’s transition would carry them, with the facts they read. Writes nothing. The alarm is named by its component and id; without an id, the component’s most recently raised alarm. A draft the sandbox refuses is a 422, one that fails to render (its output past the cap) a 422 naming it. Gated by notification_type:read; the component is resolved in the caller’s component read scope, so a component outside it is a non-disclosing 404.

name
required

The notification type’s name or uuid

string

The notification type’s name or uuid

Media type application/json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
alarm

The alarm’s id; absent previews the component’s most recently raised alarm

string
component
required

The component the alarm is on, by name or dotted address

string
>= 1 characters
subject

A draft subject to render instead of the stored one, so an editor previews before it saves

string
text

A draft text to render instead of the stored one

string
transition

The edge to render for; absent reads the alarm’s own state (cleared when it is, raised otherwise)

string
Allowed values: raised cleared

OK

Media type application/json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
facts
required

The alarm facts the subject and text read, every key in its declared order (an absent fact is empty)

Array<object> | null
object
name
required

The key a rule reads it by ({{.Name}})

string
value
required
string
subject
required

The rendered subject, as a delivery would carry it

string
text
required

The rendered text, as a delivery would carry it

string
transition
required

The edge it was rendered for

string
Allowed values: raised cleared

Example

{
"$schema": "/api/v1/schemas/PreviewNotificationTypeOutputBody.json",
"transition": "raised"
}

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"
}