Preview a notification type against an alarm
const url = 'https://example.com/api/v1/notification-types/example:preview';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"alarm":"example","component":"example","subject":"example","text":"example","transition":"raised"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”The notification type’s name or uuid
The notification type’s name or uuid
Request Bodyrequired
Section titled “ Request Bodyrequired ”object
A URL to the JSON Schema for this object.
The alarm’s id; absent previews the component’s most recently raised alarm
The component the alarm is on, by name or dotted address
A draft subject to render instead of the stored one, so an editor previews before it saves
A draft text to render instead of the stored one
The edge to render for; absent reads the alarm’s own state (cleared when it is, raised otherwise)
Responses
Section titled “ Responses ”OK
object
A URL to the JSON Schema for this object.
The alarm facts the subject and text read, every key in its declared order (an absent fact is empty)
object
The key a rule reads it by ({{.Name}})
The rendered subject, as a delivery would carry it
The rendered text, as a delivery would carry it
The edge it was rendered for
Example
{ "$schema": "/api/v1/schemas/PreviewNotificationTypeOutputBody.json", "transition": "raised"}default
Section titled “ default ”Error
object
A URL to the JSON Schema for this object.
A human-readable explanation specific to this occurrence of the problem.
Optional list of individual error details
object
Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’
Error message text
The value at the given location
A URI reference that identifies the specific occurrence of the problem.
HTTP status code
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
A URI reference to human-readable documentation for the error.
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"}