# What this PR does The `docs/reference` shortcode supports contextual destinations and version inference. `<ONCALL VERSION>` is inferred to match the version of the documentation set. For example, the inferred version for the page /docs/grafana/oncall/latest/get-started/ is "latest". It can also be overriden using front matter. Given the same page, but with the additional front matter `oncall_version: next`, the variable is substituted with "next" rather than "latest". Contextual destinations are achieved using repeated labels in the shortcode inner text. The format is [<LABEL>]: "<PAGE PATH PREFIX> -> <HUGO REFERENCE>". - _`<LABEL>`_ matches the reference style link label used in the rest of the text. - _`<PAGE PATH PREFIX>`_ is matched against the page during the production build. If the match is successful, the destination that is used is _`<HUGO REFERENCE>`_. The first matching prefix is used, not the longest matching prefix. ## Which issue(s) this PR fixes - Broken links due to ambiguous relref resolution. Any relref parameter that does not start with either `/`, `./`, or `../` can resolve ambiguously and is resulting in broken link behavior on the current site. - Broken links in Grafana Cloud. We mount OnCall documentation in Grafana Cloud. In https://github.com/grafana/website/pull/13872 the location will become /docs/grafana-cloud/alerting-and-irm/oncall. This PR is intended to be merged alongside that PR. --------- Signed-off-by: Jack Baldry <jack.baldry@grafana.com> Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
321 lines
6.6 KiB
Markdown
321 lines
6.6 KiB
Markdown
---
|
|
canonical: https://grafana.com/docs/oncall/latest/oncall-api-reference/integrations/
|
|
title: Integrations HTTP API
|
|
weight: 500
|
|
---
|
|
|
|
# Create an integration
|
|
|
|
```shell
|
|
curl "{{API_URL}}/api/v1/integrations/" \
|
|
--request POST \
|
|
--header "Authorization: meowmeowmeow" \
|
|
--header "Content-Type: application/json" \
|
|
--data '{
|
|
"type":"grafana"
|
|
}'
|
|
```
|
|
|
|
The above command returns JSON structured in the following way:
|
|
|
|
```json
|
|
{
|
|
"id": "CFRPV98RPR1U8",
|
|
"name": "Grafana :blush:",
|
|
"team_id": null,
|
|
"link": "{{API_URL}}/integrations/v1/grafana/mReAoNwDm0eMwKo1mTeTwYo/",
|
|
"inbound_email": null,
|
|
"type": "grafana",
|
|
"default_route": {
|
|
"id": "RVBE4RKQSCGJ2",
|
|
"escalation_chain_id": "F5JU6KJET33FE",
|
|
"slack": {
|
|
"channel_id": "CH23212D"
|
|
}
|
|
},
|
|
"templates": {
|
|
"grouping_key": null,
|
|
"resolve_signal": null,
|
|
"acknowledge_signal": null,
|
|
"source_link": null,
|
|
"slack": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"web": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"sms": {
|
|
"title": null
|
|
},
|
|
"phone_call": {
|
|
"title": null
|
|
},
|
|
"telegram": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"email": {
|
|
"title": null,
|
|
"message": null
|
|
},
|
|
"msteams": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
Integrations are sources of alerts and alert groups for Grafana OnCall.
|
|
For example, to learn how to integrate Grafana OnCall with Alertmanager see
|
|
[Alertmanager][alertmanager].
|
|
|
|
**HTTP request**
|
|
|
|
`POST {{API_URL}}/api/v1/integrations/`
|
|
|
|
# Get integration
|
|
|
|
```shell
|
|
curl "{{API_URL}}/api/v1/integrations/CFRPV98RPR1U8/" \
|
|
--request GET \
|
|
--header "Authorization: meowmeowmeow" \
|
|
--header "Content-Type: application/json"
|
|
```
|
|
|
|
The above command returns JSON structured in the following way:
|
|
|
|
```json
|
|
{
|
|
"id": "CFRPV98RPR1U8",
|
|
"name": "Grafana :blush:",
|
|
"team_id": null,
|
|
"link": "{{API_URL}}/integrations/v1/grafana/mReAoNwDm0eMwKo1mTeTwYo/",
|
|
"inbound_email": null,
|
|
"type": "grafana",
|
|
"default_route": {
|
|
"id": "RVBE4RKQSCGJ2",
|
|
"escalation_chain_id": "F5JU6KJET33FE",
|
|
"slack": {
|
|
"channel_id": "CH23212D"
|
|
}
|
|
},
|
|
"templates": {
|
|
"grouping_key": null,
|
|
"resolve_signal": null,
|
|
"acknowledge_signal": null,
|
|
"source_link": null,
|
|
"slack": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"web": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"sms": {
|
|
"title": null
|
|
},
|
|
"phone_call": {
|
|
"title": null
|
|
},
|
|
"telegram": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"email": {
|
|
"title": null,
|
|
"message": null
|
|
},
|
|
"msteams": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
This endpoint retrieves an integration. Integrations are sources of alerts and alert groups for Grafana OnCall.
|
|
|
|
**HTTP request**
|
|
|
|
`GET {{API_URL}}/api/v1/integrations/<INTEGRATION_ID>/`
|
|
|
|
# List integrations
|
|
|
|
```shell
|
|
curl "{{API_URL}}/api/v1/integrations/" \
|
|
--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": "CFRPV98RPR1U8",
|
|
"name": "Grafana :blush:",
|
|
"team_id": null,
|
|
"link": "{{API_URL}}/integrations/v1/grafana/mReAoNwDm0eMwKo1mTeTwYo/",
|
|
"inbound_email": null,
|
|
"type": "grafana",
|
|
"default_route": {
|
|
"id": "RVBE4RKQSCGJ2",
|
|
"escalation_chain_id": "F5JU6KJET33FE",
|
|
"slack": {
|
|
"channel_id": "CH23212D"
|
|
}
|
|
},
|
|
"templates": {
|
|
"grouping_key": null,
|
|
"resolve_signal": null,
|
|
"acknowledge_signal": null,
|
|
"source_link": null,
|
|
"slack": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"web": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"sms": {
|
|
"title": null
|
|
},
|
|
"phone_call": {
|
|
"title": null
|
|
},
|
|
"telegram": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"email": {
|
|
"title": null,
|
|
"message": null
|
|
},
|
|
"msteams": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
```
|
|
|
|
**HTTP request**
|
|
|
|
`GET {{API_URL}}/api/v1/integrations/`
|
|
|
|
# Update integration
|
|
|
|
```shell
|
|
curl "{{API_URL}}/api/v1/integrations/CFRPV98RPR1U8/" \
|
|
--request PUT \
|
|
--header "Authorization: meowmeowmeow" \
|
|
--header "Content-Type: application/json" \
|
|
--data '{
|
|
"templates": {
|
|
"grouping_key": null,
|
|
"resolve_signal": null,
|
|
"slack": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
}
|
|
}
|
|
}'
|
|
```
|
|
|
|
The above command returns JSON structured in the following way:
|
|
|
|
```json
|
|
{
|
|
"id": "CFRPV98RPR1U8",
|
|
"name": "Grafana :blush:",
|
|
"team_id": null,
|
|
"link": "{{API_URL}}/integrations/v1/grafana/mReAoNwDm0eMwKo1mTeTwYo/",
|
|
"inbound_email": null,
|
|
"type": "grafana",
|
|
"default_route": {
|
|
"id": "RVBE4RKQSCGJ2",
|
|
"escalation_chain_id": "F5JU6KJET33FE",
|
|
"slack": {
|
|
"channel_id": "CH23212D"
|
|
}
|
|
},
|
|
"templates": {
|
|
"grouping_key": null,
|
|
"resolve_signal": null,
|
|
"slack": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"web": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
},
|
|
"email": {
|
|
"title": null,
|
|
"message": null
|
|
},
|
|
"sms": {
|
|
"title": null
|
|
},
|
|
"phone_call": {
|
|
"title": null
|
|
},
|
|
"telegram": {
|
|
"title": null,
|
|
"message": null,
|
|
"image_url": null
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
**HTTP request**
|
|
|
|
`PUT {{API_URL}}/api/v1/integrations/<INTEGRATION_ID>/`
|
|
|
|
# Delete integration
|
|
|
|
Deleted integrations will stop recording new alerts from monitoring. Integration removal won't trigger removal of
|
|
related alert groups or alerts.
|
|
|
|
```shell
|
|
curl "{{API_URL}}/api/v1/integrations/CFRPV98RPR1U8/" \
|
|
--request DELETE \
|
|
--header "Authorization: meowmeowmeow"
|
|
```
|
|
|
|
**HTTP request**
|
|
|
|
`DELETE {{API_URL}}/api/v1/integrations/<INTEGRATION_ID>/`
|
|
|
|
{{% docs/reference %}}
|
|
[alertmanager]: "/docs/oncall/ -> /docs/oncall/<ONCALL VERSION>/integrations/alertmanager"
|
|
[alertmanager]: "/docs/grafana-cloud/ -> /docs/grafana-cloud/alerting-and-irm/oncall/integrations/alertmanager"
|
|
{{% /docs/reference %}}
|