Alert API

Alert API

List Alerts

GET /api/v1/repositories/$DATASPACE/alerts

Example:

curl -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN"  http://$BASEURL/api/v1/repositories/$DATASPACE/alerts

Get Alert by ID

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

Example:

curl -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN"  http://$BASEURL/api/v1/repositories/$DATASPACE/alerts/hZuxvyEitdisEA06EqzEO52gCd8PO0OR

Create Alert

POST /api/v1/repositories/$DATASPACE/alerts

Params:

  • name — string
  • query:
    • queryString — string
    • start — string
    • end — string
    • isLive — boolean — must be set to true
  • description — string
  • throttleTimeMillis — integer — maximum frequency that notifications are sent
  • silenced — boolean — whether the alert is enabled or not
  • notifiers — array — array of notifier ID strings
  • labels — array — array of text labels

Example:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN"  http://$BASEURL/api/v1/repositories/$DATASPACE/alerts -d '{"name":"test", "query": {"queryString":"foobar", "start":"1h", "isLive":true}, "description":"this is a test", "throttleTimeMillis":600000, "linkURL":"http://example.com", "silenced":false, "notifiers":["GrpMXUR2me8045Sz39qcsoWjXT3fJ7rT"], "labels":["test"]}'

Update Alert

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

Params:

  • name — string
  • query:
    • queryString — string
    • start — string
    • end — string
    • isLive — boolean — must be set to true
  • description — string
  • throttleTimeMillis — integer — maximum frequency that notifications are sent
  • silenced — boolean — whether the alert is enabled or not
  • notifiers — array — array of notifier ID strings
  • labels — array — array of text labels

Example:

curl -X PUT -H "Content-Type: application/json" -H "Authorization: Bearer $TOKEN"  http://$BASEURL/api/v1/repositories/$DATASPACE/alerts/hZuxvyEitdisEA06EqzEO52gCd8PO0OR -d '{"name":"different test", "query": {"queryString":"foobar", "start":"1h", "isLive":true}, "description":"this is a test", "throttleTimeMillis":600000, "linkURL":"http://example.com", "silenced":false, "notifiers":["GrpMXUR2me8045Sz39qcsoWjXT3fJ7rT"], "labels":["test"]}'

Delete Alert

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

Example:

curl-X DELETE -H "Authorization: Bearer $TOKEN"  http://$BASEURL/api/v1/repositories/$DATASPACE/alerts/hZuxvyEitdisEA06EqzEO52gCd8PO0OR