Alerts

GET /api/alerts/

Get all current alerts.

Example response:

Returns:

an object mapping alert IDs to alert objects

POST /api/alerts/clear

Delete all persisted alerts.

Status Codes:
DELETE /api/alerts/(int: alert_id)

Dismiss an alert.

Parameters:
  • alert_id – The ID of the alert to remove

Status Codes:
POST /api/alerts/(int: alert_id)/action/(action)

Call an alert’s callback action.

Parameters:
  • alert_id – the ID of the alert that has the action

  • action – the name of the action to perform (including the __ prefix)

Status Codes:
PUT /api/alerts/

Create a new custom alert.

Examples

Minimal

This is the smallest set of fields that can be provided.

Bad weather

This alert will expire in 3 hours and links to a website. Add ?notify=23 to the URL to also send it to the notification channel with ID 23.

Complete

This is the full set of fields that can be specified. The presence of the machine_id field means the alert will automatically be deleted if the machine is deleted.

What is the key field for?

  • Creating a new alert with the same key as an existing alert will automatically delete the existing alert first. This allows easily updating an existing alert without risking accidental duplication.

  • The key can be any string, but it’s intended to contain any information that distinguishes one instance of an alert from any other of the same type.

  • The value specified for key in the request will have custom| prepended to it to guarantee it cannot collide with any keys of built-in OnTakt alerts.

Query Parameters:
  • notify (int) – set to the ID of a notification channel to send the newly-created alert as a message in that channel in addition to registering it in OnTakt. If not set, the alert will be persisted but no notification message will be sent.

Reqjson:

a (partial) PersistentAlert object

Resjson:

the new PersistentAlert object

Status Codes: