Create
Create a new schedule override.
POST
/
v2
/
schedule_overrides
Create
curl --request POST \
--url https://api.incident.io/v2/schedule_overrides \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"end_at": "2021-08-17T14:00:00.000000Z",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"schedule_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:00:00.000000Z",
"user": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
}
'import requests
url = "https://api.incident.io/v2/schedule_overrides"
payload = {
"end_at": "2021-08-17T14:00:00.000000Z",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"schedule_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:00:00.000000Z",
"user": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
end_at: '2021-08-17T14:00:00.000000Z',
layer_id: '01G0J1EXE7AXZ2C93K61WBPYNH',
rotation_id: '01G0J1EXE7AXZ2C93K61WBPYEH',
schedule_id: '01G0J1EXE7AXZ2C93K61WBPYEH',
start_at: '2021-08-17T13:00:00.000000Z',
user: {
email: 'bob@example.com',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
slack_user_id: 'USER123'
}
})
};
fetch('https://api.incident.io/v2/schedule_overrides', 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/schedule_overrides",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'end_at' => '2021-08-17T14:00:00.000000Z',
'layer_id' => '01G0J1EXE7AXZ2C93K61WBPYNH',
'rotation_id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'schedule_id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'start_at' => '2021-08-17T13:00:00.000000Z',
'user' => [
'email' => 'bob@example.com',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'slack_user_id' => 'USER123'
]
]),
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/schedule_overrides"
payload := strings.NewReader("{\n \"end_at\": \"2021-08-17T14:00:00.000000Z\",\n \"layer_id\": \"01G0J1EXE7AXZ2C93K61WBPYNH\",\n \"rotation_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"schedule_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"start_at\": \"2021-08-17T13:00:00.000000Z\",\n \"user\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.incident.io/v2/schedule_overrides")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"end_at\": \"2021-08-17T14:00:00.000000Z\",\n \"layer_id\": \"01G0J1EXE7AXZ2C93K61WBPYNH\",\n \"rotation_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"schedule_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"start_at\": \"2021-08-17T13:00:00.000000Z\",\n \"user\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/schedule_overrides")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"end_at\": \"2021-08-17T14:00:00.000000Z\",\n \"layer_id\": \"01G0J1EXE7AXZ2C93K61WBPYNH\",\n \"rotation_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"schedule_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"start_at\": \"2021-08-17T13:00:00.000000Z\",\n \"user\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"override": {
"created_at": "2021-08-17T13:28:57.801578Z",
"end_at": "2021-08-17T13:28:57.801578Z",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"schedule_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:28:57.801578Z",
"updated_at": "2021-08-17T13:28:57.801578Z",
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
}
}Authorizations
API key from your incident.io dashboard (Settings → API keys)
Body
application/json
End time of the override
Example:
"2021-08-17T14:00:00.000000Z"
The layer this override applies to
Example:
"01G0J1EXE7AXZ2C93K61WBPYNH"
The rotation this override applies to
Example:
"01G0J1EXE7AXZ2C93K61WBPYEH"
The schedule this override applies to
Example:
"01G0J1EXE7AXZ2C93K61WBPYEH"
Start time of the override
Example:
"2021-08-17T13:00:00.000000Z"
Show child attributes
Show child attributes
Example:
{
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
Response
201 - application/json
Created response.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Create
curl --request POST \
--url https://api.incident.io/v2/schedule_overrides \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"end_at": "2021-08-17T14:00:00.000000Z",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"schedule_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:00:00.000000Z",
"user": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
}
'import requests
url = "https://api.incident.io/v2/schedule_overrides"
payload = {
"end_at": "2021-08-17T14:00:00.000000Z",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"schedule_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:00:00.000000Z",
"user": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
end_at: '2021-08-17T14:00:00.000000Z',
layer_id: '01G0J1EXE7AXZ2C93K61WBPYNH',
rotation_id: '01G0J1EXE7AXZ2C93K61WBPYEH',
schedule_id: '01G0J1EXE7AXZ2C93K61WBPYEH',
start_at: '2021-08-17T13:00:00.000000Z',
user: {
email: 'bob@example.com',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
slack_user_id: 'USER123'
}
})
};
fetch('https://api.incident.io/v2/schedule_overrides', 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/schedule_overrides",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'end_at' => '2021-08-17T14:00:00.000000Z',
'layer_id' => '01G0J1EXE7AXZ2C93K61WBPYNH',
'rotation_id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'schedule_id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'start_at' => '2021-08-17T13:00:00.000000Z',
'user' => [
'email' => 'bob@example.com',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'slack_user_id' => 'USER123'
]
]),
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/schedule_overrides"
payload := strings.NewReader("{\n \"end_at\": \"2021-08-17T14:00:00.000000Z\",\n \"layer_id\": \"01G0J1EXE7AXZ2C93K61WBPYNH\",\n \"rotation_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"schedule_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"start_at\": \"2021-08-17T13:00:00.000000Z\",\n \"user\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n}")
req, _ := http.NewRequest("POST", 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.post("https://api.incident.io/v2/schedule_overrides")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"end_at\": \"2021-08-17T14:00:00.000000Z\",\n \"layer_id\": \"01G0J1EXE7AXZ2C93K61WBPYNH\",\n \"rotation_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"schedule_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"start_at\": \"2021-08-17T13:00:00.000000Z\",\n \"user\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/schedule_overrides")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"end_at\": \"2021-08-17T14:00:00.000000Z\",\n \"layer_id\": \"01G0J1EXE7AXZ2C93K61WBPYNH\",\n \"rotation_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"schedule_id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"start_at\": \"2021-08-17T13:00:00.000000Z\",\n \"user\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n}"
response = http.request(request)
puts response.read_body{
"override": {
"created_at": "2021-08-17T13:28:57.801578Z",
"end_at": "2021-08-17T13:28:57.801578Z",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"schedule_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:28:57.801578Z",
"updated_at": "2021-08-17T13:28:57.801578Z",
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
}
}