Update
Update a schedule.
Updating a schedule replaces its entire configuration with the one you send, including any scheduled future versions of its rotations — fetch the schedule first and include every version you want to keep.
To change who’s in a rotation from a future date without affecting shifts
before then, keep the current version unchanged and add another version of the
same rotation with effective_from set to when the change should land —
ideally an upcoming handover, so nobody is swapped mid-shift. You can check the
effect of any configuration before saving it with Preview schedule entries.
curl --request PUT \
--url https://api.incident.io/v2/schedules/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"schedule": {
"annotations": {
"incident.io/terraform/version": "version-of-terraform"
},
"config": {
"rotations": [
{
"effective_from": "2021-08-17T13:28:57.801578Z",
"handover_start_at": "2021-08-17T13:28:57.801578Z",
"handovers": [
{
"interval": 1,
"interval_type": "hourly"
}
],
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layers": [
{
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Layer 1"
}
],
"name": "My Rotation",
"scheduling_mode": "fair",
"users": [
{
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
],
"working_interval": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
],
"working_intervals": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
]
}
]
},
"holidays_public_config": {
"country_codes": [
"abc123"
]
},
"name": "Primary On-call Schedule",
"team_ids": [
"01JPQA75EPNEES4479P16P4XAB"
],
"timezone": "America/Los_Angeles"
}
}
'import requests
url = "https://api.incident.io/v2/schedules/{id}"
payload = { "schedule": {
"annotations": { "incident.io/terraform/version": "version-of-terraform" },
"config": { "rotations": [
{
"effective_from": "2021-08-17T13:28:57.801578Z",
"handover_start_at": "2021-08-17T13:28:57.801578Z",
"handovers": [
{
"interval": 1,
"interval_type": "hourly"
}
],
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layers": [
{
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Layer 1"
}
],
"name": "My Rotation",
"scheduling_mode": "fair",
"users": [
{
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
],
"working_interval": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
],
"working_intervals": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
]
}
] },
"holidays_public_config": { "country_codes": ["abc123"] },
"name": "Primary On-call Schedule",
"team_ids": ["01JPQA75EPNEES4479P16P4XAB"],
"timezone": "America/Los_Angeles"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
schedule: {
annotations: {'incident.io/terraform/version': 'version-of-terraform'},
config: {
rotations: [
{
effective_from: '2021-08-17T13:28:57.801578Z',
handover_start_at: '2021-08-17T13:28:57.801578Z',
handovers: [{interval: 1, interval_type: 'hourly'}],
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
layers: [{id: '01G0J1EXE7AXZ2C93K61WBPYEH', name: 'Layer 1'}],
name: 'My Rotation',
scheduling_mode: 'fair',
users: [
{
email: 'bob@example.com',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
slack_user_id: 'USER123'
}
],
working_interval: [{end_time: '17:00', start_time: '09:00', weekday: 'monday'}],
working_intervals: [{end_time: '17:00', start_time: '09:00', weekday: 'monday'}]
}
]
},
holidays_public_config: {country_codes: ['abc123']},
name: 'Primary On-call Schedule',
team_ids: ['01JPQA75EPNEES4479P16P4XAB'],
timezone: 'America/Los_Angeles'
}
})
};
fetch('https://api.incident.io/v2/schedules/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.incident.io/v2/schedules/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'schedule' => [
'annotations' => [
'incident.io/terraform/version' => 'version-of-terraform'
],
'config' => [
'rotations' => [
[
'effective_from' => '2021-08-17T13:28:57.801578Z',
'handover_start_at' => '2021-08-17T13:28:57.801578Z',
'handovers' => [
[
'interval' => 1,
'interval_type' => 'hourly'
]
],
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'layers' => [
[
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'name' => 'Layer 1'
]
],
'name' => 'My Rotation',
'scheduling_mode' => 'fair',
'users' => [
[
'email' => 'bob@example.com',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'slack_user_id' => 'USER123'
]
],
'working_interval' => [
[
'end_time' => '17:00',
'start_time' => '09:00',
'weekday' => 'monday'
]
],
'working_intervals' => [
[
'end_time' => '17:00',
'start_time' => '09:00',
'weekday' => 'monday'
]
]
]
]
],
'holidays_public_config' => [
'country_codes' => [
'abc123'
]
],
'name' => 'Primary On-call Schedule',
'team_ids' => [
'01JPQA75EPNEES4479P16P4XAB'
],
'timezone' => 'America/Los_Angeles'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.incident.io/v2/schedules/{id}"
payload := strings.NewReader("{\n \"schedule\": {\n \"annotations\": {\n \"incident.io/terraform/version\": \"version-of-terraform\"\n },\n \"config\": {\n \"rotations\": [\n {\n \"effective_from\": \"2021-08-17T13:28:57.801578Z\",\n \"handover_start_at\": \"2021-08-17T13:28:57.801578Z\",\n \"handovers\": [\n {\n \"interval\": 1,\n \"interval_type\": \"hourly\"\n }\n ],\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"layers\": [\n {\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Layer 1\"\n }\n ],\n \"name\": \"My Rotation\",\n \"scheduling_mode\": \"fair\",\n \"users\": [\n {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n ],\n \"working_interval\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ],\n \"working_intervals\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ]\n }\n ]\n },\n \"holidays_public_config\": {\n \"country_codes\": [\n \"abc123\"\n ]\n },\n \"name\": \"Primary On-call Schedule\",\n \"team_ids\": [\n \"01JPQA75EPNEES4479P16P4XAB\"\n ],\n \"timezone\": \"America/Los_Angeles\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.incident.io/v2/schedules/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"schedule\": {\n \"annotations\": {\n \"incident.io/terraform/version\": \"version-of-terraform\"\n },\n \"config\": {\n \"rotations\": [\n {\n \"effective_from\": \"2021-08-17T13:28:57.801578Z\",\n \"handover_start_at\": \"2021-08-17T13:28:57.801578Z\",\n \"handovers\": [\n {\n \"interval\": 1,\n \"interval_type\": \"hourly\"\n }\n ],\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"layers\": [\n {\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Layer 1\"\n }\n ],\n \"name\": \"My Rotation\",\n \"scheduling_mode\": \"fair\",\n \"users\": [\n {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n ],\n \"working_interval\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ],\n \"working_intervals\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ]\n }\n ]\n },\n \"holidays_public_config\": {\n \"country_codes\": [\n \"abc123\"\n ]\n },\n \"name\": \"Primary On-call Schedule\",\n \"team_ids\": [\n \"01JPQA75EPNEES4479P16P4XAB\"\n ],\n \"timezone\": \"America/Los_Angeles\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/schedules/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"schedule\": {\n \"annotations\": {\n \"incident.io/terraform/version\": \"version-of-terraform\"\n },\n \"config\": {\n \"rotations\": [\n {\n \"effective_from\": \"2021-08-17T13:28:57.801578Z\",\n \"handover_start_at\": \"2021-08-17T13:28:57.801578Z\",\n \"handovers\": [\n {\n \"interval\": 1,\n \"interval_type\": \"hourly\"\n }\n ],\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"layers\": [\n {\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Layer 1\"\n }\n ],\n \"name\": \"My Rotation\",\n \"scheduling_mode\": \"fair\",\n \"users\": [\n {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n ],\n \"working_interval\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ],\n \"working_intervals\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ]\n }\n ]\n },\n \"holidays_public_config\": {\n \"country_codes\": [\n \"abc123\"\n ]\n },\n \"name\": \"Primary On-call Schedule\",\n \"team_ids\": [\n \"01JPQA75EPNEES4479P16P4XAB\"\n ],\n \"timezone\": \"America/Los_Angeles\"\n }\n}"
response = http.request(request)
puts response.read_body{
"schedule": {
"annotations": {
"incident.io/terraform/version": "3.0.0"
},
"config": {
"rotations": [
{
"effective_from": "2021-08-17T13:28:57.801578Z",
"handover_start_at": "2021-08-17T13:28:57.801578Z",
"handovers": [
{
"interval": 1,
"interval_type": "hourly"
}
],
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layers": [
{
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Layer 1"
}
],
"name": "Primary On-Call Schedule",
"scheduling_mode": "fair",
"users": [
{
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
],
"working_interval": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
],
"working_intervals": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
]
}
]
},
"created_at": "2021-08-17T13:28:57.801578Z",
"current_shifts": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"entry_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"fingerprint": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:28:57.801578Z",
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
}
],
"holidays_public_config": {
"country_codes": [
"GB",
"FR"
]
},
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Primary On-Call Schedule",
"next_shifts": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"entry_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"fingerprint": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:28:57.801578Z",
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
}
],
"team_ids": [
"01JPQA75EPNEES4479P16P4XAB"
],
"timezone": "Europe/London",
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}schedules.update scope.Authorizations
API key from your incident.io dashboard (Settings → API keys)
Path Parameters
The schedule ID to update.
"01G0J1EXE7AXZ2C93K61WBPYEH"
Body
Show child attributes
Show child attributes
{
"annotations": {
"incident.io/terraform/version": "version-of-terraform"
},
"config": {
"rotations": [
{
"effective_from": "2021-08-17T13:28:57.801578Z",
"handover_start_at": "2021-08-17T13:28:57.801578Z",
"handovers": [
{ "interval": 1, "interval_type": "hourly" }
],
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layers": [
{
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Layer 1"
}
],
"name": "My Rotation",
"scheduling_mode": "fair",
"users": [
{
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
],
"working_interval": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
],
"working_intervals": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
]
}
]
},
"holidays_public_config": { "country_codes": ["abc123"] },
"name": "Primary On-call Schedule",
"team_ids": ["01JPQA75EPNEES4479P16P4XAB"],
"timezone": "America/Los_Angeles"
}
Response
OK response.
Show child attributes
Show child attributes
Was this page helpful?
curl --request PUT \
--url https://api.incident.io/v2/schedules/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"schedule": {
"annotations": {
"incident.io/terraform/version": "version-of-terraform"
},
"config": {
"rotations": [
{
"effective_from": "2021-08-17T13:28:57.801578Z",
"handover_start_at": "2021-08-17T13:28:57.801578Z",
"handovers": [
{
"interval": 1,
"interval_type": "hourly"
}
],
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layers": [
{
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Layer 1"
}
],
"name": "My Rotation",
"scheduling_mode": "fair",
"users": [
{
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
],
"working_interval": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
],
"working_intervals": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
]
}
]
},
"holidays_public_config": {
"country_codes": [
"abc123"
]
},
"name": "Primary On-call Schedule",
"team_ids": [
"01JPQA75EPNEES4479P16P4XAB"
],
"timezone": "America/Los_Angeles"
}
}
'import requests
url = "https://api.incident.io/v2/schedules/{id}"
payload = { "schedule": {
"annotations": { "incident.io/terraform/version": "version-of-terraform" },
"config": { "rotations": [
{
"effective_from": "2021-08-17T13:28:57.801578Z",
"handover_start_at": "2021-08-17T13:28:57.801578Z",
"handovers": [
{
"interval": 1,
"interval_type": "hourly"
}
],
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layers": [
{
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Layer 1"
}
],
"name": "My Rotation",
"scheduling_mode": "fair",
"users": [
{
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
],
"working_interval": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
],
"working_intervals": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
]
}
] },
"holidays_public_config": { "country_codes": ["abc123"] },
"name": "Primary On-call Schedule",
"team_ids": ["01JPQA75EPNEES4479P16P4XAB"],
"timezone": "America/Los_Angeles"
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
schedule: {
annotations: {'incident.io/terraform/version': 'version-of-terraform'},
config: {
rotations: [
{
effective_from: '2021-08-17T13:28:57.801578Z',
handover_start_at: '2021-08-17T13:28:57.801578Z',
handovers: [{interval: 1, interval_type: 'hourly'}],
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
layers: [{id: '01G0J1EXE7AXZ2C93K61WBPYEH', name: 'Layer 1'}],
name: 'My Rotation',
scheduling_mode: 'fair',
users: [
{
email: 'bob@example.com',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
slack_user_id: 'USER123'
}
],
working_interval: [{end_time: '17:00', start_time: '09:00', weekday: 'monday'}],
working_intervals: [{end_time: '17:00', start_time: '09:00', weekday: 'monday'}]
}
]
},
holidays_public_config: {country_codes: ['abc123']},
name: 'Primary On-call Schedule',
team_ids: ['01JPQA75EPNEES4479P16P4XAB'],
timezone: 'America/Los_Angeles'
}
})
};
fetch('https://api.incident.io/v2/schedules/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.incident.io/v2/schedules/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'schedule' => [
'annotations' => [
'incident.io/terraform/version' => 'version-of-terraform'
],
'config' => [
'rotations' => [
[
'effective_from' => '2021-08-17T13:28:57.801578Z',
'handover_start_at' => '2021-08-17T13:28:57.801578Z',
'handovers' => [
[
'interval' => 1,
'interval_type' => 'hourly'
]
],
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'layers' => [
[
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'name' => 'Layer 1'
]
],
'name' => 'My Rotation',
'scheduling_mode' => 'fair',
'users' => [
[
'email' => 'bob@example.com',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'slack_user_id' => 'USER123'
]
],
'working_interval' => [
[
'end_time' => '17:00',
'start_time' => '09:00',
'weekday' => 'monday'
]
],
'working_intervals' => [
[
'end_time' => '17:00',
'start_time' => '09:00',
'weekday' => 'monday'
]
]
]
]
],
'holidays_public_config' => [
'country_codes' => [
'abc123'
]
],
'name' => 'Primary On-call Schedule',
'team_ids' => [
'01JPQA75EPNEES4479P16P4XAB'
],
'timezone' => 'America/Los_Angeles'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.incident.io/v2/schedules/{id}"
payload := strings.NewReader("{\n \"schedule\": {\n \"annotations\": {\n \"incident.io/terraform/version\": \"version-of-terraform\"\n },\n \"config\": {\n \"rotations\": [\n {\n \"effective_from\": \"2021-08-17T13:28:57.801578Z\",\n \"handover_start_at\": \"2021-08-17T13:28:57.801578Z\",\n \"handovers\": [\n {\n \"interval\": 1,\n \"interval_type\": \"hourly\"\n }\n ],\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"layers\": [\n {\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Layer 1\"\n }\n ],\n \"name\": \"My Rotation\",\n \"scheduling_mode\": \"fair\",\n \"users\": [\n {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n ],\n \"working_interval\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ],\n \"working_intervals\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ]\n }\n ]\n },\n \"holidays_public_config\": {\n \"country_codes\": [\n \"abc123\"\n ]\n },\n \"name\": \"Primary On-call Schedule\",\n \"team_ids\": [\n \"01JPQA75EPNEES4479P16P4XAB\"\n ],\n \"timezone\": \"America/Los_Angeles\"\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.incident.io/v2/schedules/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"schedule\": {\n \"annotations\": {\n \"incident.io/terraform/version\": \"version-of-terraform\"\n },\n \"config\": {\n \"rotations\": [\n {\n \"effective_from\": \"2021-08-17T13:28:57.801578Z\",\n \"handover_start_at\": \"2021-08-17T13:28:57.801578Z\",\n \"handovers\": [\n {\n \"interval\": 1,\n \"interval_type\": \"hourly\"\n }\n ],\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"layers\": [\n {\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Layer 1\"\n }\n ],\n \"name\": \"My Rotation\",\n \"scheduling_mode\": \"fair\",\n \"users\": [\n {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n ],\n \"working_interval\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ],\n \"working_intervals\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ]\n }\n ]\n },\n \"holidays_public_config\": {\n \"country_codes\": [\n \"abc123\"\n ]\n },\n \"name\": \"Primary On-call Schedule\",\n \"team_ids\": [\n \"01JPQA75EPNEES4479P16P4XAB\"\n ],\n \"timezone\": \"America/Los_Angeles\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/schedules/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"schedule\": {\n \"annotations\": {\n \"incident.io/terraform/version\": \"version-of-terraform\"\n },\n \"config\": {\n \"rotations\": [\n {\n \"effective_from\": \"2021-08-17T13:28:57.801578Z\",\n \"handover_start_at\": \"2021-08-17T13:28:57.801578Z\",\n \"handovers\": [\n {\n \"interval\": 1,\n \"interval_type\": \"hourly\"\n }\n ],\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"layers\": [\n {\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Layer 1\"\n }\n ],\n \"name\": \"My Rotation\",\n \"scheduling_mode\": \"fair\",\n \"users\": [\n {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n ],\n \"working_interval\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ],\n \"working_intervals\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ]\n }\n ]\n },\n \"holidays_public_config\": {\n \"country_codes\": [\n \"abc123\"\n ]\n },\n \"name\": \"Primary On-call Schedule\",\n \"team_ids\": [\n \"01JPQA75EPNEES4479P16P4XAB\"\n ],\n \"timezone\": \"America/Los_Angeles\"\n }\n}"
response = http.request(request)
puts response.read_body{
"schedule": {
"annotations": {
"incident.io/terraform/version": "3.0.0"
},
"config": {
"rotations": [
{
"effective_from": "2021-08-17T13:28:57.801578Z",
"handover_start_at": "2021-08-17T13:28:57.801578Z",
"handovers": [
{
"interval": 1,
"interval_type": "hourly"
}
],
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layers": [
{
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Layer 1"
}
],
"name": "Primary On-Call Schedule",
"scheduling_mode": "fair",
"users": [
{
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
],
"working_interval": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
],
"working_intervals": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
]
}
]
},
"created_at": "2021-08-17T13:28:57.801578Z",
"current_shifts": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"entry_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"fingerprint": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:28:57.801578Z",
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
}
],
"holidays_public_config": {
"country_codes": [
"GB",
"FR"
]
},
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Primary On-Call Schedule",
"next_shifts": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"entry_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"fingerprint": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:28:57.801578Z",
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
}
],
"team_ids": [
"01JPQA75EPNEES4479P16P4XAB"
],
"timezone": "Europe/London",
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}