OnCall shifts HTTP API
Create an OnCall shift
Required permission: grafana-oncall-app.schedules:write
curl "{{API_URL}}/api/v1/on_call_shifts/" \
--request POST \
--header "Authorization: meowmeowmeow" \
--header "Content-Type: application/json" \
--data '{
"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"
]
}'
The above command returns JSON structured in the following way:
{
"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"]
}
For more information about recurrence rules, refer to RFC 5545.
HTTP request
POST {{API_URL}}/api/v1/on_call_shifts/
Get OnCall shifts
Required permission: grafana-oncall-app.schedules:read
curl "{{API_URL}}/api/v1/on_call_shifts/OH3V5FYQEYJ6M/" \
--request GET \
--header "Authorization: meowmeowmeow" \
--header "Content-Type: application/json" \
The above command returns JSON structured in the following way:
{
"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"]
}
HTTP request
GET {{API_URL}}/api/v1/on_call_shifts/<ON_CALL_SHIFT_ID>/
List OnCall shifts
Required permission: grafana-oncall-app.schedules:read
curl "{{API_URL}}/api/v1/on_call_shifts/" \
--request GET \
--header "Authorization: meowmeowmeow" \
--header "Content-Type: application/json"
The above command returns JSON structured in the following way:
Note: The response is paginated. You may need to make multiple requests to get all records.
The following available filter parameters should be provided as GET
arguments:
name
(Exact match)schedule_id
(Exact match)
HTTP request
GET {{API_URL}}/api/v1/on_call_shifts/
Update OnCall shift
Required permission: grafana-oncall-app.schedules:write
curl "{{API_URL}}/api/v1/on_call_shifts/OH3V5FYQEYJ6M/" \
--request PUT \
--header "Authorization: meowmeowmeow" \
--header "Content-Type: application/json" \
--data '{
"name": "Demo single event",
"type": "single_event",
"level": 0,
"start": "2020-09-10T08:00:00",
"duration": 10800,
"users": [
"U4DNY931HHJS5"
]
}'
The above command returns JSON structured in the following way:
{
"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"]
}
HTTP request
PUT {{API_URL}}/api/v1/on_call_shifts/<ON_CALL_SHIFT_ID>/
Delete OnCall shift
Required permission: grafana-oncall-app.schedules:write
curl "{{API_URL}}/api/v1/on_call_shifts/OH3V5FYQEYJ6M/" \
--request DELETE \
--header "Authorization: meowmeowmeow" \
--header "Content-Type: application/json"
HTTP request
DELETE {{API_URL}}/api/v1/on_call_shifts/<ON_CALL_SHIFT_ID>/