Create
Create a new maintenance window.
curl --request POST \
--url https://api.incident.io/v1/maintenance_windows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alert_condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"end_at": "2021-08-17T14:28:57.801578Z",
"escalation_targets": [
{
"escalation_paths": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"users": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"incident_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"lead": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
},
"name": "Planned database migration",
"notification_message": "Scheduled downtime for database migration",
"notify_channels": [
{
"channel_id": "C0ACTHQMHS8",
"channel_name": "general",
"channel_type": "public"
}
],
"notify_end_minutes_before": 5,
"notify_start_minutes_before": 15,
"reroute_on_end": false,
"resolve_on_end": false,
"show_in_sidebar": true,
"start_at": "2021-08-17T13:28:57.801578Z"
}
'import requests
url = "https://api.incident.io/v1/maintenance_windows"
payload = {
"alert_condition_groups": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"end_at": "2021-08-17T14:28:57.801578Z",
"escalation_targets": [
{
"escalation_paths": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"users": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"incident_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"lead": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
},
"name": "Planned database migration",
"notification_message": "Scheduled downtime for database migration",
"notify_channels": [
{
"channel_id": "C0ACTHQMHS8",
"channel_name": "general",
"channel_type": "public"
}
],
"notify_end_minutes_before": 5,
"notify_start_minutes_before": 15,
"reroute_on_end": False,
"resolve_on_end": False,
"show_in_sidebar": True,
"start_at": "2021-08-17T13:28:57.801578Z"
}
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({
alert_condition_groups: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
end_at: '2021-08-17T14:28:57.801578Z',
escalation_targets: [
{
escalation_paths: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
},
users: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
}
],
incident_id: '01FCNDV6P870EA6S7TK1DSYDG0',
lead: {
email: 'bob@example.com',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
slack_user_id: 'USER123'
},
name: 'Planned database migration',
notification_message: 'Scheduled downtime for database migration',
notify_channels: [{channel_id: 'C0ACTHQMHS8', channel_name: 'general', channel_type: 'public'}],
notify_end_minutes_before: 5,
notify_start_minutes_before: 15,
reroute_on_end: false,
resolve_on_end: false,
show_in_sidebar: true,
start_at: '2021-08-17T13:28:57.801578Z'
})
};
fetch('https://api.incident.io/v1/maintenance_windows', 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/v1/maintenance_windows",
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([
'alert_condition_groups' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'end_at' => '2021-08-17T14:28:57.801578Z',
'escalation_targets' => [
[
'escalation_paths' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'users' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
]
],
'incident_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'lead' => [
'email' => 'bob@example.com',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'slack_user_id' => 'USER123'
],
'name' => 'Planned database migration',
'notification_message' => 'Scheduled downtime for database migration',
'notify_channels' => [
[
'channel_id' => 'C0ACTHQMHS8',
'channel_name' => 'general',
'channel_type' => 'public'
]
],
'notify_end_minutes_before' => 5,
'notify_start_minutes_before' => 15,
'reroute_on_end' => false,
'resolve_on_end' => false,
'show_in_sidebar' => true,
'start_at' => '2021-08-17T13:28:57.801578Z'
]),
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/v1/maintenance_windows"
payload := strings.NewReader("{\n \"alert_condition_groups\": [\n {\n \"conditions\": [\n {\n \"operation\": \"one_of\",\n \"param_bindings\": [\n {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n ],\n \"subject\": \"incident.severity\"\n }\n ]\n }\n ],\n \"end_at\": \"2021-08-17T14:28:57.801578Z\",\n \"escalation_targets\": [\n {\n \"escalation_paths\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n },\n \"users\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n }\n ],\n \"incident_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"lead\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"name\": \"Planned database migration\",\n \"notification_message\": \"Scheduled downtime for database migration\",\n \"notify_channels\": [\n {\n \"channel_id\": \"C0ACTHQMHS8\",\n \"channel_name\": \"general\",\n \"channel_type\": \"public\"\n }\n ],\n \"notify_end_minutes_before\": 5,\n \"notify_start_minutes_before\": 15,\n \"reroute_on_end\": false,\n \"resolve_on_end\": false,\n \"show_in_sidebar\": true,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\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/v1/maintenance_windows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alert_condition_groups\": [\n {\n \"conditions\": [\n {\n \"operation\": \"one_of\",\n \"param_bindings\": [\n {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n ],\n \"subject\": \"incident.severity\"\n }\n ]\n }\n ],\n \"end_at\": \"2021-08-17T14:28:57.801578Z\",\n \"escalation_targets\": [\n {\n \"escalation_paths\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n },\n \"users\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n }\n ],\n \"incident_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"lead\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"name\": \"Planned database migration\",\n \"notification_message\": \"Scheduled downtime for database migration\",\n \"notify_channels\": [\n {\n \"channel_id\": \"C0ACTHQMHS8\",\n \"channel_name\": \"general\",\n \"channel_type\": \"public\"\n }\n ],\n \"notify_end_minutes_before\": 5,\n \"notify_start_minutes_before\": 15,\n \"reroute_on_end\": false,\n \"resolve_on_end\": false,\n \"show_in_sidebar\": true,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v1/maintenance_windows")
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 \"alert_condition_groups\": [\n {\n \"conditions\": [\n {\n \"operation\": \"one_of\",\n \"param_bindings\": [\n {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n ],\n \"subject\": \"incident.severity\"\n }\n ]\n }\n ],\n \"end_at\": \"2021-08-17T14:28:57.801578Z\",\n \"escalation_targets\": [\n {\n \"escalation_paths\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n },\n \"users\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n }\n ],\n \"incident_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"lead\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"name\": \"Planned database migration\",\n \"notification_message\": \"Scheduled downtime for database migration\",\n \"notify_channels\": [\n {\n \"channel_id\": \"C0ACTHQMHS8\",\n \"channel_name\": \"general\",\n \"channel_type\": \"public\"\n }\n ],\n \"notify_end_minutes_before\": 5,\n \"notify_start_minutes_before\": 15,\n \"reroute_on_end\": false,\n \"resolve_on_end\": false,\n \"show_in_sidebar\": true,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\n}"
response = http.request(request)
puts response.read_body{
"maintenance_window": {
"alert_condition_groups": [
{
"conditions": [
{
"operation": {
"label": "Lawrence Jones",
"value": "01FCQSP07Z74QMMYPDDGQB9FTG"
},
"param_bindings": [
{
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": {
"label": "Incident Severity",
"reference": "incident.severity"
}
}
]
}
],
"archived_at": "2021-08-17T13:28:57.801578Z",
"created_at": "2021-08-17T13:28:57.801578Z",
"end_at": "2021-08-17T14:28:57.801578Z",
"escalation_targets": [
{
"escalation_paths": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
},
"users": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"incident_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"lead": {
"alert": {
"id": "01GW2G3V0S59R238FAHPDS1R66",
"title": "*errors.withMessage: PG::Error failed to connect"
},
"api_key": {
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "My test API key"
},
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
},
"workflow": {
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "My little workflow"
}
},
"name": "Planned database migration",
"notification_message": "Scheduled downtime for database migration",
"notify_channels": [
{
"channel_id": "C0ACTHQMHS8",
"channel_name": "general",
"channel_type": "public",
"is_private": false
}
],
"notify_end_minutes_before": 5,
"notify_start_minutes_before": 15,
"reroute_on_end": false,
"resolve_on_end": false,
"show_in_sidebar": true,
"start_at": "2021-08-17T13:28:57.801578Z",
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}maintenance_window.create scope.Authorizations
API key from your incident.io dashboard (Settings → API keys)
Body
Condition groups that determine which alerts this maintenance window applies to
Show child attributes
Show child attributes
[
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
]
When the maintenance window should end
"2021-08-17T14:28:57.801578Z"
Show child attributes
Show child attributes
{
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
Human readable name for the maintenance window
"Planned database migration"
Whether to show this maintenance window in the dashboard sidebar when active
true
When the maintenance window should start
"2021-08-17T13:28:57.801578Z"
If set, alerts matching this window will be escalated to these targets
Show child attributes
Show child attributes
[
{
"escalation_paths": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"users": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
]
If set, alerts matching this window will be automatically attached to this incident
"01FCNDV6P870EA6S7TK1DSYDG0"
Custom message included in notifications about this maintenance window
"Scheduled downtime for database migration"
Channels to notify about the maintenance window starting and ending
Show child attributes
Show child attributes
[
{
"channel_id": "C0ACTHQMHS8",
"channel_name": "general",
"channel_type": "public"
}
]
Minutes before the end to send a notification to the configured channels
5
Minutes before the start to send a notification to the configured channels
15
Whether to retrigger firing alerts through alert routing when the window ends
false
Whether to automatically resolve all firing alerts that matched this window when it ends
false
Response
Created response.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.incident.io/v1/maintenance_windows \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"alert_condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"end_at": "2021-08-17T14:28:57.801578Z",
"escalation_targets": [
{
"escalation_paths": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"users": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"incident_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"lead": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
},
"name": "Planned database migration",
"notification_message": "Scheduled downtime for database migration",
"notify_channels": [
{
"channel_id": "C0ACTHQMHS8",
"channel_name": "general",
"channel_type": "public"
}
],
"notify_end_minutes_before": 5,
"notify_start_minutes_before": 15,
"reroute_on_end": false,
"resolve_on_end": false,
"show_in_sidebar": true,
"start_at": "2021-08-17T13:28:57.801578Z"
}
'import requests
url = "https://api.incident.io/v1/maintenance_windows"
payload = {
"alert_condition_groups": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"end_at": "2021-08-17T14:28:57.801578Z",
"escalation_targets": [
{
"escalation_paths": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"users": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"incident_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"lead": {
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
},
"name": "Planned database migration",
"notification_message": "Scheduled downtime for database migration",
"notify_channels": [
{
"channel_id": "C0ACTHQMHS8",
"channel_name": "general",
"channel_type": "public"
}
],
"notify_end_minutes_before": 5,
"notify_start_minutes_before": 15,
"reroute_on_end": False,
"resolve_on_end": False,
"show_in_sidebar": True,
"start_at": "2021-08-17T13:28:57.801578Z"
}
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({
alert_condition_groups: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
end_at: '2021-08-17T14:28:57.801578Z',
escalation_targets: [
{
escalation_paths: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
},
users: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
}
],
incident_id: '01FCNDV6P870EA6S7TK1DSYDG0',
lead: {
email: 'bob@example.com',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
slack_user_id: 'USER123'
},
name: 'Planned database migration',
notification_message: 'Scheduled downtime for database migration',
notify_channels: [{channel_id: 'C0ACTHQMHS8', channel_name: 'general', channel_type: 'public'}],
notify_end_minutes_before: 5,
notify_start_minutes_before: 15,
reroute_on_end: false,
resolve_on_end: false,
show_in_sidebar: true,
start_at: '2021-08-17T13:28:57.801578Z'
})
};
fetch('https://api.incident.io/v1/maintenance_windows', 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/v1/maintenance_windows",
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([
'alert_condition_groups' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'end_at' => '2021-08-17T14:28:57.801578Z',
'escalation_targets' => [
[
'escalation_paths' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'users' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
]
],
'incident_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'lead' => [
'email' => 'bob@example.com',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'slack_user_id' => 'USER123'
],
'name' => 'Planned database migration',
'notification_message' => 'Scheduled downtime for database migration',
'notify_channels' => [
[
'channel_id' => 'C0ACTHQMHS8',
'channel_name' => 'general',
'channel_type' => 'public'
]
],
'notify_end_minutes_before' => 5,
'notify_start_minutes_before' => 15,
'reroute_on_end' => false,
'resolve_on_end' => false,
'show_in_sidebar' => true,
'start_at' => '2021-08-17T13:28:57.801578Z'
]),
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/v1/maintenance_windows"
payload := strings.NewReader("{\n \"alert_condition_groups\": [\n {\n \"conditions\": [\n {\n \"operation\": \"one_of\",\n \"param_bindings\": [\n {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n ],\n \"subject\": \"incident.severity\"\n }\n ]\n }\n ],\n \"end_at\": \"2021-08-17T14:28:57.801578Z\",\n \"escalation_targets\": [\n {\n \"escalation_paths\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n },\n \"users\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n }\n ],\n \"incident_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"lead\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"name\": \"Planned database migration\",\n \"notification_message\": \"Scheduled downtime for database migration\",\n \"notify_channels\": [\n {\n \"channel_id\": \"C0ACTHQMHS8\",\n \"channel_name\": \"general\",\n \"channel_type\": \"public\"\n }\n ],\n \"notify_end_minutes_before\": 5,\n \"notify_start_minutes_before\": 15,\n \"reroute_on_end\": false,\n \"resolve_on_end\": false,\n \"show_in_sidebar\": true,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\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/v1/maintenance_windows")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"alert_condition_groups\": [\n {\n \"conditions\": [\n {\n \"operation\": \"one_of\",\n \"param_bindings\": [\n {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n ],\n \"subject\": \"incident.severity\"\n }\n ]\n }\n ],\n \"end_at\": \"2021-08-17T14:28:57.801578Z\",\n \"escalation_targets\": [\n {\n \"escalation_paths\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n },\n \"users\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n }\n ],\n \"incident_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"lead\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"name\": \"Planned database migration\",\n \"notification_message\": \"Scheduled downtime for database migration\",\n \"notify_channels\": [\n {\n \"channel_id\": \"C0ACTHQMHS8\",\n \"channel_name\": \"general\",\n \"channel_type\": \"public\"\n }\n ],\n \"notify_end_minutes_before\": 5,\n \"notify_start_minutes_before\": 15,\n \"reroute_on_end\": false,\n \"resolve_on_end\": false,\n \"show_in_sidebar\": true,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v1/maintenance_windows")
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 \"alert_condition_groups\": [\n {\n \"conditions\": [\n {\n \"operation\": \"one_of\",\n \"param_bindings\": [\n {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n ],\n \"subject\": \"incident.severity\"\n }\n ]\n }\n ],\n \"end_at\": \"2021-08-17T14:28:57.801578Z\",\n \"escalation_targets\": [\n {\n \"escalation_paths\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n },\n \"users\": {\n \"array_value\": [\n {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n ],\n \"value\": {\n \"literal\": \"SEV123\",\n \"reference\": \"incident.severity\"\n }\n }\n }\n ],\n \"incident_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"lead\": {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n },\n \"name\": \"Planned database migration\",\n \"notification_message\": \"Scheduled downtime for database migration\",\n \"notify_channels\": [\n {\n \"channel_id\": \"C0ACTHQMHS8\",\n \"channel_name\": \"general\",\n \"channel_type\": \"public\"\n }\n ],\n \"notify_end_minutes_before\": 5,\n \"notify_start_minutes_before\": 15,\n \"reroute_on_end\": false,\n \"resolve_on_end\": false,\n \"show_in_sidebar\": true,\n \"start_at\": \"2021-08-17T13:28:57.801578Z\"\n}"
response = http.request(request)
puts response.read_body{
"maintenance_window": {
"alert_condition_groups": [
{
"conditions": [
{
"operation": {
"label": "Lawrence Jones",
"value": "01FCQSP07Z74QMMYPDDGQB9FTG"
},
"param_bindings": [
{
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": {
"label": "Incident Severity",
"reference": "incident.severity"
}
}
]
}
],
"archived_at": "2021-08-17T13:28:57.801578Z",
"created_at": "2021-08-17T13:28:57.801578Z",
"end_at": "2021-08-17T14:28:57.801578Z",
"escalation_targets": [
{
"escalation_paths": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
},
"users": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"incident_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"lead": {
"alert": {
"id": "01GW2G3V0S59R238FAHPDS1R66",
"title": "*errors.withMessage: PG::Error failed to connect"
},
"api_key": {
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "My test API key"
},
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
},
"workflow": {
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "My little workflow"
}
},
"name": "Planned database migration",
"notification_message": "Scheduled downtime for database migration",
"notify_channels": [
{
"channel_id": "C0ACTHQMHS8",
"channel_name": "general",
"channel_type": "public",
"is_private": false
}
],
"notify_end_minutes_before": 5,
"notify_start_minutes_before": 15,
"reroute_on_end": false,
"resolve_on_end": false,
"show_in_sidebar": true,
"start_at": "2021-08-17T13:28:57.801578Z",
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}