oncall-engine/docs/sources/oncall-api-reference/alerts.md
Jack Baldry d3921a5386
Remove absolute aliases as it can cause unexpected redirects in future versions (#1793)
If a page is removed in a future version, the presence of a "latest"
absolute alias in a previous version can redirect that removed page.

**Notes for reviewer:**
I would like to make similar changes for older, previously published
versions.
I believe you are only publishing documentation on specific tag events
and are not maintaining long lived release branches for backporting
fixes into.
If my understanding is correct, I will make the changes in the website
repository
(https://github.com/grafana/website/tree/master/content/docs/oncall).

Signed-off-by: Jack Baldry <jack.baldry@grafana.com>
2023-06-05 09:03:38 +00:00

2.6 KiB

canonical title weight
https://grafana.com/docs/oncall/latest/oncall-api-reference/alerts/ Alerts HTTP API 100

List Alerts

curl "{{API_URL}}/api/v1/alerts/" \
  --request GET \
  --header "Authorization: meowmeowmeow" \
  --header "Content-Type: application/json"

The above command returns JSON structured in the following way:

{
  "count": 3,
  "next": null,
  "previous": null,
  "results": [
    {
      "id": "AA74DN7T4JQB6",
      "alert_group_id": "I68T24C13IFW1",
      "created_at": "2020-05-11T20:07:43Z",
      "payload": {
        "state": "alerting",
        "title": "[Alerting] Test notification",
        "ruleId": 0,
        "message": "Someone is testing the alert notification within Grafana.",
        "ruleUrl": "{{API_URL}}/",
        "ruleName": "Test notification",
        "evalMatches": [
          {
            "tags": null,
            "value": 100,
            "metric": "High value"
          },
          {
            "tags": null,
            "value": 200,
            "metric": "Higher Value"
          }
        ]
      }
    },
    {
      "id": "AR9SSYFKE2PV7",
      "alert_group_id": "I68T24C13IFW1",
      "created_at": "2020-05-11T20:07:54Z",
      "payload": {
        "state": "alerting",
        "title": "[Alerting] Test notification",
        "ruleId": 0,
        "message": "Someone is testing the alert notification within Grafana.",
        "ruleUrl": "{{API_URL}}/",
        "ruleName": "Test notification",
        "evalMatches": [
          {
            "tags": null,
            "value": 100,
            "metric": "High value"
          },
          {
            "tags": null,
            "value": 200,
            "metric": "Higher Value"
          }
        ]
      }
    },
    {
      "id": "AWJQSGEYYUFGH",
      "alert_group_id": "I68T24C13IFW1",
      "created_at": "2020-05-11T20:07:58Z",
      "payload": {
        "state": "alerting",
        "title": "[Alerting] Test notification",
        "ruleId": 0,
        "message": "Someone is testing the alert notification within Grafana.",
        "ruleUrl": "{{API_URL}}/",
        "ruleName": "Test notification",
        "evalMatches": [
          {
            "tags": null,
            "value": 100,
            "metric": "High value"
          },
          {
            "tags": null,
            "value": 200,
            "metric": "Higher Value"
          }
        ]
      }
    }
  ]
}

The following available filter parameters should be provided as GET arguments:

  • id
  • alert_group_id
  • search—string-based inclusion search by alert payload

HTTP request

GET {{API_URL}}/api/v1/alerts/