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:
204 No Content – on success
- DELETE /api/alerts/(int: alert_id)
Dismiss an alert.
- Parameters:
alert_id – The ID of the alert to remove
- Status Codes:
404 Not Found – if the alert does not exist
204 No Content – on success
- 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:
404 Not Found – if the alert or action does not exist
501 Not Implemented – if the action does not exist
424 Failed Dependency – if there is an error executing the action
204 No Content – on success
- 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 havecustom|
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:
201 Created – on success
400 Bad Request – if a required is missing or any provided field invalid