### Webhook Response Example Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/outgoing_webhooks An example of the JSON structure returned when fetching webhook responses. ```json { "next": null, "previous": null, "results": [ { "timestamp": "2023-08-18T16:38:23.106015Z", "url": "https://example.com", "request_trigger": "", "request_headers": "{\"Authorization\": \"****************\"}", "request_data": "{\"labels\": {\"alertname\": \"InstanceDown\", \"job\": \"node\", \"severity\": \"critical\"}}", "status_code": 200, "content": "", "event_data": "{\"event\": {\"type\": \"acknowledge\", \"time\": \"2023-08-18T16:38:21.442981+00:00\"}, \"user\": {\"id\": \"UK49JJNPZMFLJ\", \"username\": \"oncall\", \"email\": \"admin@localhost\"}, \"alert_group\": {\"id\": \"IZQERPWKWCGH1\", \"integration_id\": \"CRV8A5MXC751A\", \"route_id\": \"RWNCT6C77M3WM\", \"alerts_count\": 1, \"state\": \"acknowledged\", \"created_at\": \"2023-08-18T16:34:27.678406Z\", \"resolved_at\": null, \"acknowledged_at\": \"2023-08-18T16:38:21.442981Z\", \"title\": \"[firing:2] InstanceDown \", \"permalinks\": {\"slack\": null, \"telegram\": null, \"web\": \"http://localhost:3000/a/grafana-oncall-app/alert-groups/IZQERPWKWCGH1\"}}, \"alert_group_id\": \"IZQERPWKWCGH1\", \"alert_payload\": {\"alerts\": [{\"endsAt\": \"0001-01-01T00:00:00Z\", \"labels\": {\"job\": \"node\", \"group\": \"production\", \"instance\": \"localhost:8081\", \"severity\": \"critical\", \"alertname\": \"InstanceDown\"}, \"status\": \"firing\", \"startsAt\": \"2023-06-12T08:24:38.326Z\", \"annotations\": {\"title\": \"Instance localhost:8081 down\", \"description\": \"localhost:8081 of job node has been down for more than 1 minute.\"}, \"fingerprint\": \"f404ecabc8dd5cd7\", \"generatorURL\": \""}, {\"endsAt\": \"0001-01-01T00:00:00Z\", \"labels\": {\"job\": \"node\", \"group\": \"canary\", \"instance\": \"localhost:8082\", \"severity\": \"critical\", \"alertname\": \"InstanceDown\"}, \"status\": \"firing\", \"startsAt\": \"2023-06-12T08:24:38.326Z\", \"annotations\": {\"title\": \"Instance localhost:8082 down\", \"description\": \"localhost:8082 of job node has been down for more than 1 minute.\"}, \"fingerprint\": \"f8f08d4e32c61a9d\", \"generatorURL\": \""}], \"status\": \"firing\", \"version\": \"4\", \"groupKey\": \"{}:{alertname=\"InstanceDown\"}\", \"receiver\": \"combo\", \"numFiring\": 2, \"externalURL\": \"\", \"groupLabels\": {\"alertname\": \"InstanceDown\"}, \"numResolved\": 0, \"commonLabels\": {\"job\": \"node\", \"severity\": \"critical\", \"alertname\": \"InstanceDown\"}, \"truncatedAlerts\": 0, \"commonAnnotations\": {}}}, \"integration\": {\"id\": \"CRV8A5MXC751A\", \"type\": \"alertmanager\", \"name\": \"One - Alertmanager\", \"team\": null}, \"notified_users\": [], \"users_to_be_notified\": []}" }, { "timestamp": "2023-08-18T16:34:38.580574Z", "url": "https://example.com", "request_trigger": "", "request_headers": null, "request_data": "Data - Template Warning: Object of type Undefined is not JSON serializable", "status_code": null, "content": null } ] } ``` -------------------------------- ### Create Route Response Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/routes This is an example of the JSON response received after successfully creating a route. It includes the unique ID assigned to the route and confirms the configuration details. ```json { "id": "RIYGUJXCPFHXY", "integration_id": "CFRPV98RPR1U8", "escalation_chain_id": "F5JU6KJET33FE", "routing_regex": "us-(east|west)", "position": 0, "is_the_last_route": false, "slack": { "channel_id": "CH23212D" } } ``` -------------------------------- ### Integration creation response JSON Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/integrations This is an example of the JSON response received after successfully creating an integration. It includes details such as the integration ID, name, team association, and configuration for various notification channels. ```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 }, "mobile_app": { "title": null, "message": null }, "email": { "title": null, "message": null }, "msteams": { "title": null, "message": null, "image_url": null } }, "labels": [], "dynamic_labels": [] } ``` -------------------------------- ### Get Outgoing Webhook Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/outgoing_webhooks Use this command to retrieve the configuration of a specific outgoing webhook by its UID. Ensure you have the necessary read permissions. ```shell curl "{{API_URL}}/api/v1/webhooks/{{WEBHOOK_UID}}/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` -------------------------------- ### Integration Response Structure Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/integrations This is an example of the JSON response when listing integrations. It includes details such as integration ID, name, type, and default routing information. Note that the response is paginated. ```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 }, "mobile_app": { "title": null, "message": null }, "email": { "title": null, "message": null }, "msteams": { "title": null, "message": null, "image_url": null } } }, "labels": [], "dynamic_labels": [] ], "current_page_number": 1, "page_size": 50, "total_pages": 1 } ``` -------------------------------- ### Example JSON response for listing schedules Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/schedules This is the structure of the JSON response when listing schedules. It includes pagination details and a list of schedule objects. Available filters include `name` and `team_id`. ```json { "count": 2, "next": null, "previous": null, "results": [ { "id": "SBM7DV7BKFUYU", "name": "Demo schedule iCal", "type": "ical", "team_id": null, "ical_url_primary": "https://example.com/meow_calendar.ics", "ical_url_overrides": "https://example.com/meow_calendar_overrides.ics", "on_call_now": ["U4DNY931HHJS5"], "slack": { "channel_id": "MEOW_SLACK_ID", "user_group_id": "MEOW_SLACK_ID" } }, { "id": "S3Z477AHDXTMF", "name": "Demo schedule Calendar", "type": "calendar", "team_id": null, "time_zone": "America/New_York", "on_call_now": ["U4DNY931HHJS5"], "shifts": ["OH3V5FYQEYJ6M", "O9WTH7CKM3KZW"], "ical_url_overrides": null, "slack": { "channel_id": "MEOW_SLACK_ID", "user_group_id": "MEOW_SLACK_ID" } } ], "current_page_number": 1, "page_size": 50, "total_pages": 1 } ``` -------------------------------- ### Get an organization using curl Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/organizations Use this command to retrieve a specific organization's details by its ID. Ensure you include the correct Authorization header. ```shell curl "{{API_URL}}/api/v1/organizations/O53AAGWFBPE5W/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` -------------------------------- ### List Escalation Policies Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_policies Use this command to retrieve a list of all escalation policies. The response is paginated, and you can filter results by providing the `escalation_chain_id` as a GET argument. Ensure you have the `grafana-oncall-app.escalation-chains:read` permission. ```shell curl "{{API_URL}}/api/v1/escalation_policies/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` -------------------------------- ### Create a Route Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/routes Use this command to create a new route via the API. Ensure you replace placeholder values with your actual integration and escalation chain IDs, and define the desired routing regex and Slack channel. ```shell curl "{{API_URL}}/api/v1/routes/" \ --request POST \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" \ --data '{ \ "integration_id": "CFRPV98RPR1U8", \ "escalation_chain_id": "F5JU6KJET33FE", \ "routing_regex": "us-(east|west)", \ "position": 0, \ "slack": { \ "channel_id": "CH23212D" \ } \ }' ``` -------------------------------- ### Get Escalation Chain Response Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_chains The response for getting an escalation chain provides its ID, name, and team ID. ```json { "id": "F5JU6KJET33FE", "name": "default", "team_id": null } ``` -------------------------------- ### Get a schedule Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/schedules Retrieves details for a specific schedule using its ID. ```APIDOC ## Get a schedule **Required permission**: `grafana-oncall-app.schedules:read` ### Method GET ### Endpoint `{{API_URL}}/api/v1/schedules//` ### Description Retrieves details for a specific schedule. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the schedule. - **name** (string) - The name of the schedule. - **type** (string) - The type of the schedule (e.g., 'ical', 'calendar'). - **team_id** (string or null) - The ID of the team associated with the schedule. - **ical_url_primary** (string) - The primary iCal URL for the schedule. - **ical_url_overrides** (string or null) - The URL for iCal overrides. - **on_call_now** (array of strings) - A list of user IDs currently on call. - **slack** (object) - Slack integration details. - **channel_id** (string) - The Slack channel ID. - **user_group_id** (string) - The Slack user group ID. ### Request Example ```shell curl "{{API_URL}}/api/v1/schedules/SBM7DV7BKFUYU/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" \ ``` ### Response Example ```json { "id": "SBM7DV7BKFUYU", "name": "Demo schedule iCal", "type": "ical", "team_id": null, "ical_url_primary": "https://example.com/meow_calendar.ics", "ical_url_overrides": "https://example.com/meow_calendar_overrides.ics", "on_call_now": ["U4DNY931HHJS5"], "slack": { "channel_id": "MEOW_SLACK_ID", "user_group_id": "MEOW_SLACK_ID" } } ``` ``` -------------------------------- ### Create Webhook Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/outgoing_webhooks Creates a new outgoing webhook with specified configurations. ```APIDOC ## POST /api/v1/webhooks/ ### Description Creates a new outgoing webhook. ### Method POST ### Endpoint /api/v1/webhooks/ ### Parameters #### Request Body - **name** (string) - Required - The name of the webhook. - **url** (string) - Required - The URL the webhook will be sent to. - **http_method** (string) - Required - The HTTP method to use (e.g., POST, GET, PUT, DELETE, OPTIONS). - **trigger_type** (string) - Required - The type of event that triggers the webhook (e.g., `escalation`, `acknowledge`, `resolve`). - **is_webhook_enabled** (boolean) - Optional - Indicates if the webhook is enabled. - **team** (string or null) - Optional - The team associated with the webhook. - **data** (string) - Optional - The data payload for the webhook. - **username** (string or null) - Optional - Username for authentication. - **password** (string or null) - Optional - Password for authentication. - **trigger_template** (string or null) - Optional - The trigger template for the webhook. - **headers** (object or null) - Optional - Custom headers for the webhook. - **forward_all** (boolean) - Optional - Whether to forward all events. - **integration_filter** (array of strings or null) - Optional - Filters for integrations. ### Request Example ```shell curl "{{API_URL}}/api/v1/webhooks/" \ --request POST \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" \ --data '{ "name": "New Webhook", "url": "https://example.com", "http_method": "POST", "trigger_type" : "resolve" }' ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the webhook. - **name** (string) - The name of the webhook. - **is_webhook_enabled** (boolean) - Indicates if the webhook is enabled. - **team** (string or null) - The team associated with the webhook. - **data** (string or null) - The data payload for the webhook. - **username** (string or null) - Username for authentication. - **password** (string or null) - Password for authentication. - **authorization_header** (string or null) - The authorization header value. - **trigger_template** (string or null) - The trigger template for the webhook. - **headers** (object or null) - Custom headers for the webhook. - **url** (string) - The URL the webhook will be sent to. - **forward_all** (boolean) - Whether to forward all events. - **http_method** (string) - The HTTP method to use for the webhook. - **trigger_type** (string) - The type of event that triggers the webhook. - **integration_filter** (array of strings or null) - Filters for integrations. #### Response Example ```json { "id": "{{WEBHOOK_UID}}", "name": "New Webhook", "is_webhook_enabled": true, "team": null, "data": null, "username": null, "password": null, "authorization_header": null, "trigger_template": null, "headers": null, "url": "https://example.com", "forward_all": true, "http_method": "POST", "trigger_type": "resolve", "integration_filter": null } ``` ``` -------------------------------- ### Get Webhook Responses Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/outgoing_webhooks Retrieves a list of responses for a specific outgoing webhook. ```APIDOC ## Get webhook responses ### Method GET ### Endpoint /api/v1/webhooks/{{WEBHOOK_UID}}/responses ### Success Response (200) Returns a list of webhook responses. ### Response Example ```json { "next": null, "previous": null, "results": [ { "timestamp": "2023-08-18T16:38:23.106015Z", "url": "https://example.com", "request_trigger": "", "request_headers": "{\"Authorization\": \"****************\"}", "request_data": "{\"labels\": {\"alertname\": \"InstanceDown\", \"job\": \"node\", \"severity\": \"critical\"}}", "status_code": 200, "content": "", "event_data": "{\"event\": {\"type\": \"acknowledge\", \"time\": \"2023-08-18T16:38:21.442981+00:00\"}, \"user\": {\"id\": \"UK49JJNPZMFLJ\", \"username\": \"oncall\", \"email\": \"admin@localhost\"}, \"alert_group\": {\"id\": \"IZQERPWKWCGH1\", \"integration_id\": \"CRV8A5MXC751A\", \"route_id\": \"RWNCT6C77M3WM\", \"alerts_count\": 1, \"state\": \"acknowledged\", \"created_at\": \"2023-08-18T16:34:27.678406Z\", \"resolved_at\": null, \"acknowledged_at\": \"2023-08-18T16:38:21.442981Z\", \"title\": \"[firing:2] InstanceDown \", \"permalinks\": {\"slack\": null, \"telegram\": null, \"web\": \"http://localhost:3000/a/grafana-oncall-app/alert-groups/IZQERPWKWCGH1\"}}, \"alert_group_id\": \"IZQERPWKWCGH1\", \"alert_payload\": {\"alerts\": [{\"endsAt\": \"0001-01-01T00:00:00Z\", \"labels\": {\"job\": \"node\", \"group\": \"production\", \"instance\": \"localhost:8081\", \"severity\": \"critical\", \"alertname\": \"InstanceDown\"}, \"status\": \"firing\", \"startsAt\": \"2023-06-12T08:24:38.326Z\", \"annotations\": {\"title\": \"Instance localhost:8081 down\", \"description\": \"localhost:8081 of job node has been down for more than 1 minute.\"}, \"fingerprint\": \"f404ecabc8dd5cd7\", \"generatorURL\": \""}, {\"endsAt\": \"0001-01-01T00:00:00Z\", \"labels\": {\"job\": \"node\", \"group\": \"canary\", \"instance\": \"localhost:8082\", \"severity\": \"critical\", \"alertname\": \"InstanceDown\"}, \"status\": \"firing\", \"startsAt\": \"2023-06-12T08:24:38.326Z\", \"annotations\": {\"title\": \"Instance localhost:8082 down\", \"description\": \"localhost:8082 of job node has been down for more than 1 minute.\"}, \"fingerprint\": \"f8f08d4e32c61a9d\", \"generatorURL\": \""}], \"status\": \"firing\", \"version\": \"4\", \"groupKey\": \"{}:{alertname=\"InstanceDown\"}\", \"receiver\": \"combo\", \"numFiring\": 2, \"externalURL\": \"\", \"groupLabels\": {\"alertname\": \"InstanceDown\"}, \"numResolved\": 0, \"commonLabels\": {\"job\": \"node\", \"severity\": \"critical\", \"alertname\": \"InstanceDown\"}, \"truncatedAlerts\": 0, \"commonAnnotations\": {}}, \"integration\": {\"id\": \"CRV8A5MXC751A\", \"type\": \"alertmanager\", \"name\": \"One - Alertmanager\", \"team\": null}, \"notified_users\": [], \"users_to_be_notified\": []} }, { "timestamp": "2023-08-18T16:34:38.580574Z", "url": "https://example.com", "request_trigger": "", "request_headers": null, "request_data": "Data - Template Warning: Object of type Undefined is not JSON serializable", "status_code": null, "content": null } ] } ``` ``` -------------------------------- ### Get Webhook Responses Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/outgoing_webhooks Retrieve a list of responses for a specific outgoing webhook. ```shell curl "{{API_URL}}/api/v1/webhooks/{{WEBHOOK_UID}}/responses" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` -------------------------------- ### Create a Schedule using curl Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/schedules Use this command to create a new schedule by sending a POST request to the schedules endpoint. Ensure you replace placeholders like {{API_URL}}, meowmeowmeow, and the calendar URL with your actual values. The request body must be in JSON format. ```shell curl "{{API_URL}}/api/v1/schedules/" \ --request POST \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" \ --data '{ "name": "Demo schedule iCal", "ical_url_primary": "https://example.com/meow_calendar.ics", "slack": { "channel_id": "MEOW_SLACK_ID", "user_group_id": "MEOW_SLACK_ID" } }' ``` -------------------------------- ### Get Webhook Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/outgoing_webhooks Retrieves details of a specific outgoing webhook using its UID. ```APIDOC ## GET /api/v1/webhooks/{{WEBHOOK_UID}}/ ### Description Retrieves details of a specific outgoing webhook. ### Method GET ### Endpoint /api/v1/webhooks/{{WEBHOOK_UID}}/ ### Parameters #### Path Parameters - **WEBHOOK_UID** (string) - Required - The unique identifier of the webhook. ### Request Example ```shell curl "{{API_URL}}/api/v1/webhooks/{{WEBHOOK_UID}}/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the webhook. - **name** (string) - The name of the webhook. - **is_webhook_enabled** (boolean) - Indicates if the webhook is enabled. - **team** (string or null) - The team associated with the webhook. - **data** (string) - The data payload for the webhook. - **username** (string or null) - Username for authentication. - **password** (string or null) - Password for authentication. - **authorization_header** (string) - The authorization header value (masked). - **trigger_template** (string or null) - The trigger template for the webhook. - **headers** (object or null) - Custom headers for the webhook. - **url** (string) - The URL the webhook will be sent to. - **forward_all** (boolean) - Whether to forward all events. - **http_method** (string) - The HTTP method to use for the webhook. - **trigger_type** (string) - The type of event that triggers the webhook. - **integration_filter** (array of strings or null) - Filters for integrations. #### Response Example ```json { "id": "{{WEBHOOK_UID}}", "name": "Demo Webhook", "is_webhook_enabled": true, "team": null, "data": "{\"labels\" : {{ alert_payload.commonLabels | tojson()}}}", "username": null, "password": null, "authorization_header": "****************", "trigger_template": null, "headers": null, "url": "https://example.com", "forward_all": false, "http_method": "POST", "trigger_type": "acknowledge", "integration_filter": [ "CRV8A5MXC751A" ] } ``` ``` -------------------------------- ### Get an Escalation Policy Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_policies Retrieves details of a specific escalation policy using its ID. ```APIDOC ## GET /api/v1/escalation_policies// ### Description Retrieves details of a specific escalation policy. ### Method GET ### Endpoint `/api/v1/escalation_policies//` ### Parameters #### Path Parameters - **ESCALATION_POLICY_ID** (string) - Required - The ID of the escalation policy to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the escalation policy. - **escalation_chain_id** (string) - The ID of the associated escalation chain. - **position** (integer) - The position of this policy within the chain. - **type** (string) - The type of the escalation policy (e.g., "wait"). - **duration** (integer) - The duration in seconds for this policy step. ### Response Example ```json { "id": "E3GA6SJETWWJS", "escalation_chain_id": "F5JU6KJET33FE", "position": 0, "type": "wait", "duration": 60 } ``` ``` -------------------------------- ### List Escalation Chains Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/escalation_chains Fetch a list of all available escalation chains. This endpoint supports pagination and requires read permissions. ```shell curl "{{API_URL}}/api/v1/escalation_chains/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` -------------------------------- ### Get Alert Group Details Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/alertgroups Retrieves the details of a specific alert group using its unique ID. ```APIDOC ## GET /api/v1/alert_groups/ ### Description Retrieves the details of a specific alert group. ### Method GET ### Endpoint `/api/v1/alert_groups/` ### Parameters #### Path Parameters - **ALERT_GROUP_ID** (string) - Required - The unique identifier of the alert group. ### Response #### Success Response (200) - **alert_group_id** (string) - The ID of the alert group. - **created_at** (string) - The timestamp when the alert group was created. - **updated_at** (string) - The timestamp when the alert group was last updated. - **resolved_at** (string) - The timestamp when the alert group was resolved, if applicable. - **acknowledged_at** (string) - The timestamp when the alert group was acknowledged, if applicable. - **silenced_at** (string) - The timestamp when the alert group was silenced, if applicable. - **labels** (object) - A key-value map of labels associated with the alert group. - **annotations** (object) - A key-value map of annotations associated with the alert group. - **state** (string) - The current state of the alert group (e.g., 'firing', 'acknowledged', 'resolved'). - **assignees** (array) - A list of users assigned to the alert group. - **silence_id** (string) - The ID of the silence applied to the alert group, if any. - **alert_group_labels** (object) - Labels specific to the alert group configuration. - **alert_group_annotations** (object) - Annotations specific to the alert group configuration. ### Request Example ```shell curl "{{API_URL}}/api/v1/alert_groups/I68T24C13IFW1" \ --request GET \ --header "Authorization: meowmeowmeow" ``` ### Response Example ```json { "alert_group_id": "I68T24C13IFW1", "created_at": "2023-10-27T10:00:00Z", "updated_at": "2023-10-27T10:05:00Z", "resolved_at": null, "acknowledged_at": null, "silenced_at": null, "labels": { "severity": "critical", "service": "api" }, "annotations": { "summary": "High CPU usage detected." }, "state": "firing", "assignees": [ "user1" ], "silence_id": null, "alert_group_labels": { "team": "backend" }, "alert_group_annotations": { "runbook_url": "http://example.com/runbook" } } ``` ``` -------------------------------- ### List Integrations using curl Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/integrations Use this command to retrieve a list of all configured integrations. Requires 'grafana-oncall-app.integrations:read' permission. The response is paginated. ```shell curl "{{API_URL}}/api/v1/integrations/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` -------------------------------- ### Get OnCall Shift by ID Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/on_call_shifts Retrieves the details of a specific on-call shift using its unique ID. ```APIDOC ## Get OnCall Shift by ID ### Description Retrieves the details of a specific on-call shift using its unique ID. ### Method GET ### Endpoint `GET {{API_URL}}/api/v1/on_call_shifts//` ### Parameters #### Path Parameters - **ON_CALL_SHIFT_ID** (string) - Required - The unique identifier of the on-call shift. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the shift. - **name** (string) - The name of the shift. - **type** (string) - The type of the shift (e.g., "single_event", "recurrent_event"). - **team_id** (string or null) - The ID of the team associated with the shift. - **time_zone** (string or null) - The time zone of the shift. - **level** (integer) - The shift level. - **start** (string) - The start time of the shift in ISO 8601 format. - **duration** (integer) - The duration of the shift in seconds. - **users** (array of strings) - A list of user IDs assigned to the shift. ### Response Example ```json { "id": "OH3V5FYQEYJ6M", "name": "Demo single event", "type": "single_event", "team_id": null, "time_zone": null, "level": 0, "start": "2020-09-10T08:00:00", "duration": 10800, "users": ["U4DNY931HHJS5"] } ``` ``` -------------------------------- ### List Integrations Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/integrations Retrieves a list of all configured integrations. This endpoint supports pagination. ```APIDOC ## GET /api/v1/integrations/ ### Description Retrieves a list of all configured integrations. The response is paginated. ### Method GET ### Endpoint /api/v1/integrations/ ### Request Example ```shell curl "{{API_URL}}/api/v1/integrations/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` ### Response #### Success Response (200) - **count** (integer) - The total number of integrations. - **next** (string) - URL for the next page of results, or null if none. - **previous** (string) - URL for the previous page of results, or null if none. - **results** (array) - A list of integration objects. - **id** (string) - The unique identifier for the integration. - **name** (string) - The name of the integration. - **team_id** (string) - The ID of the team associated with the integration, or null. - **link** (string) - A direct link to the integration configuration. - **inbound_email** (string) - The inbound email address for the integration, or null. - **type** (string) - The type of the integration (e.g., "grafana"). - **default_route** (object) - Configuration for the default route. - **id** (string) - The ID of the default route. - **escalation_chain_id** (string) - The ID of the escalation chain. - **slack** (object) - Slack channel details for the route. - **channel_id** (string) - The Slack channel ID. - **templates** (object) - Notification templates for the integration. - **grouping_key** (string) - Template for grouping signals. - **resolve_signal** (string) - Template for resolving signals. - **acknowledge_signal** (string) - Template for acknowledging signals. - **source_link** (string) - Template for the source link. - **slack** (object) - Slack notification template. - **title** (string) - Slack message title template. - **message** (string) - Slack message content template. - **image_url** (string) - URL for an image in the Slack message. - **web** (object) - Webhook notification template. - **title** (string) - Webhook message title template. - **message** (string) - Webhook message content template. - **image_url** (string) - URL for an image in the webhook message. - **sms** (object) - SMS notification template. - **title** (string) - SMS message title template. - **phone_call** (object) - Phone call notification template. - **title** (string) - Phone call title template. - **telegram** (object) - Telegram notification template. - **title** (string) - Telegram message title template. - **message** (string) - Telegram message content template. - **image_url** (string) - URL for an image in the Telegram message. - **mobile_app** (object) - Mobile app notification template. - **title** (string) - Mobile app notification title template. - **message** (string) - Mobile app notification message template. - **email** (object) - Email notification template. - **title** (string) - Email subject template. - **message** (string) - Email body template. - **msteams** (object) - Microsoft Teams notification template. - **title** (string) - MS Teams message title template. - **message** (string) - MS Teams message content template. - **image_url** (string) - URL for an image in the MS Teams message. - **labels** (array) - List of labels associated with the integration. - **dynamic_labels** (array) - List of dynamic labels associated with the integration. - **current_page_number** (integer) - The current page number of the results. - **page_size** (integer) - The number of items per page. - **total_pages** (integer) - The total number of pages available. ### Response Example ```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 }, "mobile_app": { "title": null, "message": null }, "email": { "title": null, "message": null }, "msteams": { "title": null, "message": null, "image_url": null } } }, "labels": [], "dynamic_labels": [] ], "current_page_number": 1, "page_size": 50, "total_pages": 1 } ``` ``` -------------------------------- ### Get a route Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/routes Retrieves details for a specific route using its ID. Requires read permission for integrations. ```APIDOC ## Get a route ### Description Retrieves details for a specific route using its ID. ### Method GET ### Endpoint `{{API_URL}}/api/v1/routes//` ### Parameters #### Path Parameters - **ROUTE_ID** (string) - Required - The unique identifier of the route. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the route. - **integration_id** (string) - The ID of the integration associated with the route. - **escalation_chain_id** (string) - The ID of the escalation chain associated with the route. - **routing_regex** (string) - The regex used for routing. - **position** (integer) - The position of the route in the sequence. - **is_the_last_route** (boolean) - Indicates if this is the last route in the sequence. - **slack** (object) - Slack integration details. - **channel_id** (string) - The Slack channel ID. ### Request Example ```json { "id": "RIYGUJXCPFHXY", "integration_id": "CFRPV98RPR1U8", "escalation_chain_id": "F5JU6KJET33FE", "routing_regex": "us-(east|west)", "position": 0, "is_the_last_route": false, "slack": { "channel_id": "CH23212D" } } ``` ``` -------------------------------- ### Create Outgoing Webhook Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/outgoing_webhooks Use this command to create a new outgoing webhook. You must provide a name, URL, HTTP method, and trigger type. Ensure you have the necessary write permissions. ```shell curl "{{API_URL}}/api/v1/webhooks/" \ --request POST \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" \ --data '{ \ "name": "New Webhook", \ "url": "https://example.com", \ "http_method": "POST", \ "trigger_type" : "resolve" \ }' ``` -------------------------------- ### List User Groups Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/user_groups Use this command to retrieve a list of user groups. Ensure you have the necessary read permissions. ```shell curl "{{API_URL}}/api/v1/user_groups/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` -------------------------------- ### Get a resolution note Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/resolution_notes Retrieves a specific resolution note by its ID. Requires `grafana-oncall-app.alert-groups:read` permission. ```APIDOC ## Get a resolution note ### Description Retrieves the details of a specific resolution note using its unique identifier. ### Method GET ### Endpoint `{{API_URL}}/api/v1/resolution_notes//` ### Parameters #### Path Parameters - **RESOLUTION_NOTE_ID** (string) - Required - The ID of the resolution note to retrieve. ### Response #### Success Response (200) - **id** (string) - The unique identifier for the resolution note. - **alert_group_id** (string) - The ID of the associated alert group. - **author** (string) - The ID of the user who created the note. - **source** (string) - The source from which the note was created. - **created_at** (string) - The timestamp when the note was created. - **text** (string) - The content of the resolution note. #### Response Example ```json { "id": "M4BTQUS3PRHYQ", "alert_group_id": "I68T24C13IFW1", "author": "U4DNY931HHJS5", "source": "web", "created_at": "2020-06-19T12:40:01.429805Z", "text": "Demo resolution note" } ``` ``` -------------------------------- ### List Slack Channels using curl Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/slack_channels Use this command to list all available Slack channels. Ensure you have the required `grafana-oncall-app.chatops:read` permission. The response is paginated. ```shell curl "{{API_URL}}/api/v1/slack_channels/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` -------------------------------- ### Get an organization Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/organizations Retrieves a specific organization object using its ID. Requires read permissions for other settings. ```APIDOC ## GET /api/v1/organizations// ### Description This endpoint retrieves the organization object. ### Method GET ### Endpoint /api/v1/organizations// ### Parameters #### Path Parameters - **id** (string) - Yes - Organization ID ### Request Example ```shell curl "{{API_URL}}/api/v1/organizations/O53AAGWFBPE5W/" \ --request GET \ --header "Authorization: meowmeowmeow" \ --header "Content-Type: application/json" ``` ### Response #### Success Response (200) - **id** (string) - The ID of the organization #### Response Example ```json { "id": "O53AAGWFBPE5W" } ``` ``` -------------------------------- ### Get an organization response JSON Source: https://grafana.com/docs/oncall/latest/oncall-api-reference/organizations This is the expected JSON structure when successfully retrieving an organization's data. ```json { "id": "O53AAGWFBPE5W" } ```