Co-authored-by: Eve832 <eve.meelan@grafana.com>
Co-authored-by: Francisco Montes de Oca <nevermind89x@gmail.com>
Co-authored-by: Ildar Iskhakov <ildar.iskhakov@grafana.com>
Co-authored-by: Innokentii Konstantinov <innokenty.konstantinov@grafana.com>
Co-authored-by: Julia <ferril.darkdiver@gmail.com>
Co-authored-by: maskin25 <kengurek@gmail.com>
Co-authored-by: Matias Bordese <mbordese@gmail.com>
Co-authored-by: Matvey Kukuy <motakuk@gmail.com>
Co-authored-by: Michael Derynck <michael.derynck@grafana.com>
Co-authored-by: Richard Hartmann <richih@richih.org>
Co-authored-by: Robby Milo <robbymilo@fastmail.com>
Co-authored-by: Timur Olzhabayev <timur.olzhabayev@grafana.com>
Co-authored-by: Vadim Stepanov <vadimkerr@gmail.com>
Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
68 lines
No EOL
1.9 KiB
Markdown
68 lines
No EOL
1.9 KiB
Markdown
+++
|
|
title = "Alert groups HTTP API"
|
|
aliases = ["/docs/grafana-cloud/oncall/oncall-api-reference/alertgroups/"]
|
|
weight = 400
|
|
+++
|
|
|
|
# List alert groups
|
|
|
|
```shell
|
|
curl "{{API_URL}}/api/v1/alert_groups/" \
|
|
--request GET \
|
|
--header "Authorization: meowmeowmeow" \
|
|
--header "Content-Type: application/json"
|
|
```
|
|
|
|
The above command returns JSON structured in the following way:
|
|
|
|
```json
|
|
{
|
|
"count": 1,
|
|
"next": null,
|
|
"previous": null,
|
|
"results": [
|
|
{
|
|
"id": "I68T24C13IFW1",
|
|
"integration_id": "CFRPV98RPR1U8",
|
|
"route_id": "RIYGUJXCPFHXY",
|
|
"alerts_count": 3,
|
|
"state": "resolved",
|
|
"created_at": "2020-05-19T12:37:01.430444Z",
|
|
"resolved_at": "2020-05-19T13:37:01.429805Z",
|
|
"acknowledged_at": null,
|
|
"title": "Memory above 90% threshold"
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
These available filter parameters should be provided as `GET` arguments:
|
|
|
|
* `route_id`
|
|
* `integration_id`
|
|
|
|
**HTTP request**
|
|
|
|
`GET {{API_URL}}/api/v1/alert_groups/`
|
|
|
|
# Delete alert groups
|
|
|
|
```shell
|
|
curl "{{API_URL}}/api/v1/alert_groups/I68T24C13IFW1/" \
|
|
--request DELETE \
|
|
--header "Authorization: meowmeowmeow" \
|
|
--header "Content-Type: application/json" \
|
|
--data '{
|
|
"mode": "wipe"
|
|
}'
|
|
```
|
|
|
|
|Parameter | Required | Description |
|
|
|--------- |:--------:|:------------|
|
|
`mode` | No | Default setting is `wipe`. `wipe` will remove the payload of all Grafana OnCall group alerts. This is useful if you sent sensitive data to OnCall. All metadata will remain. `DELETE` will trigger the removal of alert groups, alerts, and all related metadata. It will also remove alert group notifications in Slack and other destinations.
|
|
|
|
>**NOTE:** `DELETE` can take a few moments to delete alert groups because Grafana OnCall interacts with 3rd party APIs such as Slack. Please check objects using `GET` to be sure the data is removed.
|
|
|
|
**HTTP request**
|
|
|
|
`DELETE {{API_URL}}/api/v1/alert_groups/<ALERT_GROUP_ID>` |