Notifier API

Notifier API

List notifiers

GET /api/v1/repositories/$DATASPACE/alertnotifiers

Example:

curl -H "Authorization: Bearer $TOKEN"  http://$YOUR_HUMIO_URL/api/v1/repositories/$DATASPACE/alertnotifiers

Get Notifier by ID

GET /api/v1/repositories/$DATASPACE/alertnotifiers/$ID

Example:

curl -H "Authorization: Bearer $TOKEN"  http://$YOUR_HUMIO_URL/api/v1/repositories/$DATASPACE/alertnotifiers/GXso4uF2EawsVyvtr2Q6DbtlWNPKwtOj

Create Notifier

POST /api/v1/repositories/$DATASPACE/alertnotifiers

Params:

  • name — string
  • entity — string — SlackNotifier, OpsGenieNotifier, PagerDutyNotifier, VictorOpsNotifier, WebHookNotifier, EmailNotifier
  • properties:
    • SlackNotifier:
      • url — string
      • fields — hash
    • OpsGenieNotifier:
      • apiUrl — string
      • genieKey — string
    • PagerDutyNotifier:
      • severity — string — critical, error, warning, info
      • routingKey — string
    • VictorOpsNotifier:
      • messageType — string
      • notifyUrl — string
    • WebHookNotifier:
      • url — string
      • method — string — GET, HEAD, OPTIONS, PATCH, POST, PUT
      • headers — hash
      • bodyTemplate — string
    • EmailNotifier:
      • recipients — array — array of email address strings
      • subjectTemplate — string
      • bodyTemplate — string

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN"  http://$YOUR_HUMIO_URL/api/v1/repositories/$DATASPACE/alertnotifiers -d '{"name":"test", "entity": "WebHookNotifier", "properties": {"url":"http://example.com", "method":"POST", "headers": {"Content-Type":"application/json"}, "bodyTemplate":"{\n  \"repository\": \"{repo_name}\",\n  \"timestamp\": \"{alert_triggered_timestamp}\",\n  \"alert\": {\n    \"name\": \"{alert_name}\",\n    \"description\": \"{alert_description}\",\n    \"query\": {\n      \"queryString\": \"{query_string} \",\n      \"end\": \"{query_time_end}\",\n      \"start\": \"{query_time_start}\"\n    },\n    \"notifierID\": \"{alert_notifier_id}\",\n    \"id\": \"{alert_id}\"\n },\n  \"warnings\": \"{warnings}\",\n  \"events\": {events},\n  \"numberOfEvents\": {event_count}\n}"}}'

Update Notifier

PUT /api/v1/repositories/$DATASPACE/alertnotifiers/$ID

Params:

  • name - string
  • entity - string - SlackNotifier, OpsGenieNotifier, PagerDutyNotifier, VictorOpsNotifier, WebHookNotifier, EmailNotifier
  • properties:
    • SlackNotifier:
      • url - string
      • fields - hash
    • OpsGenieNotifier:
      • apiUrl - string
      • genieKey - string
    • PagerDutyNotifier:
      • severity - string - critical, error, warning, info
      • routingKey - string
    • VictorOpsNotifier:
      • messageType - string
      • notifyUrl - string
    • WebHookNotifier:
      • url - string
      • method - string - GET, HEAD, OPTIONS, PATCH, POST, PUT
      • headers - hash
      • bodyTemplate - string
    • EmailNotifier:
      • recipients - array - array of email address strings
      • subjectTemplate - string
      • bodyTemplate - string

Example:

curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN"  http://$YOUR_HUMIO_URL/api/v1/repositories/$DATASPACE/alertnotifiers/GXso4uF2EawsVyvtr2Q6DbtlWNPKwtOj -d '{"name":"test", "entity": "WebHookNotifier", "properties": {"url":"http://example.com", "method":"POST", "headers": {"Content-Type":"application/json"}, "bodyTemplate":"{\n  \"repository\": \"{repo_name}\",\n  \"timestamp\": \"{alert_triggered_timestamp}\",\n  \"alert\": {\n    \"name\": \"{alert_name}\",\n    \"description\": \"{alert_description}\",\n    \"query\": {\n      \"queryString\": \"{query_string} \",\n      \"end\": \"{query_time_end}\",\n      \"start\": \"{query_time_start}\"\n    },\n    \"notifierID\": \"{alert_notifier_id}\",\n    \"id\": \"{alert_id}\"\n },\n  \"warnings\": \"{warnings}\",\n  \"events\": {events},\n  \"numberOfEvents\": {event_count}\n}"}}'

Delete Notifier

DELETE /api/v1/repositories/$DATASPACE/alertnotifiers/$ID

Example:

curl -X DELETE -H "Authorization: Bearer $TOKEN"  http://$YOUR_HUMIO_URL/api/v1/repositories/$DATASPACE/alertnotifiers/GXso4uF2EawsVyvtr2Q6DbtlWNPKwtOj