Create
Create a new policy.
curl --request POST \
--url https://api.incident.io/v2/policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assignment_rules": {
"bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"reminder_detected_date_offset_hours": [
0,
48
],
"reminder_due_date_offset_hours": [
-24,
0,
24
]
},
"conditions": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"debrief": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"run_on_private_incidents": false
},
"description": "All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.",
"expressions": [
{
"else_branch": {
"result": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
},
"label": "Team Slack channel",
"operations": [
{
"branches": {
"branches": [
{
"condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"result": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"returns": {
"array": true,
"type": "IncidentStatus"
}
},
"cast": {
"returns": {
"array": true,
"type": "IncidentStatus"
}
},
"concatenate": {
"reference": "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]"
},
"filter": {
"condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
]
},
"navigate": {
"reference": "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]"
},
"operation_type": "navigate",
"parse": {
"returns": {
"array": true,
"type": "IncidentStatus"
},
"source": "metadata.annotations[\"github.com/repo\"]"
}
}
],
"reference": "abc123",
"root_reference": "incident.status"
}
],
"follow_up": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"run_on_private_incidents": false
},
"name": "Critical incidents must export follow-ups",
"on_call_readiness": {
"enforcement": "advisory",
"high_urgency": [
{
"max_delay_seconds": 300,
"method_types": [
"slack"
]
}
],
"low_urgency": [
{
"max_delay_seconds": 300,
"method_types": [
"slack"
]
}
]
},
"policy_type": "follow_up",
"post_mortem": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"run_on_private_incidents": false
},
"schedule": {
"evaluation_level": "schedule",
"requirement_type": "contiguous"
},
"status": "enabled"
}
'import requests
url = "https://api.incident.io/v2/policies"
payload = {
"assignment_rules": {
"bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"reminder_detected_date_offset_hours": [0, 48],
"reminder_due_date_offset_hours": [-24, 0, 24]
},
"conditions": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"debrief": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"run_on_private_incidents": False
},
"description": "All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.",
"expressions": [
{
"else_branch": { "result": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
} },
"label": "Team Slack channel",
"operations": [
{
"branches": {
"branches": [
{
"condition_groups": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"result": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"returns": {
"array": True,
"type": "IncidentStatus"
}
},
"cast": { "returns": {
"array": True,
"type": "IncidentStatus"
} },
"concatenate": { "reference": "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]" },
"filter": { "condition_groups": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }] },
"navigate": { "reference": "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]" },
"operation_type": "navigate",
"parse": {
"returns": {
"array": True,
"type": "IncidentStatus"
},
"source": "metadata.annotations[\"github.com/repo\"]"
}
}
],
"reference": "abc123",
"root_reference": "incident.status"
}
],
"follow_up": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"run_on_private_incidents": False
},
"name": "Critical incidents must export follow-ups",
"on_call_readiness": {
"enforcement": "advisory",
"high_urgency": [
{
"max_delay_seconds": 300,
"method_types": ["slack"]
}
],
"low_urgency": [
{
"max_delay_seconds": 300,
"method_types": ["slack"]
}
]
},
"policy_type": "follow_up",
"post_mortem": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"run_on_private_incidents": False
},
"schedule": {
"evaluation_level": "schedule",
"requirement_type": "contiguous"
},
"status": "enabled"
}
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({
assignment_rules: {
bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
reminder_detected_date_offset_hours: [0, 48],
reminder_due_date_offset_hours: [-24, 0, 24]
},
conditions: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
debrief: {
due_date_config: {
applies_from: '2021-08-17T13:28:57.801578Z',
calculation_timezone: 'Europe/London',
calculation_type: 'weekdays',
days: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
},
incident_timestamp_id: '01FCNDV6P870EA6S7TK1DSYDG0'
},
requirements: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
run_on_private_incidents: false
},
description: 'All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.',
expressions: [
{
else_branch: {
result: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
},
label: 'Team Slack channel',
operations: [
{
branches: {
branches: [
{
condition_groups: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
result: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
}
],
returns: {array: true, type: 'IncidentStatus'}
},
cast: {returns: {array: true, type: 'IncidentStatus'}},
concatenate: {reference: 'catalog_attribute["01FCNDV6P870EA6S7TK1DSYD5H"]'},
filter: {
condition_groups: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
]
},
navigate: {reference: 'catalog_attribute["01FCNDV6P870EA6S7TK1DSYD5H"]'},
operation_type: 'navigate',
parse: {
returns: {array: true, type: 'IncidentStatus'},
source: 'metadata.annotations["github.com/repo"]'
}
}
],
reference: 'abc123',
root_reference: 'incident.status'
}
],
follow_up: {
due_date_config: {
applies_from: '2021-08-17T13:28:57.801578Z',
calculation_timezone: 'Europe/London',
calculation_type: 'weekdays',
days: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
},
incident_timestamp_id: '01FCNDV6P870EA6S7TK1DSYDG0'
},
requirements: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
run_on_private_incidents: false
},
name: 'Critical incidents must export follow-ups',
on_call_readiness: {
enforcement: 'advisory',
high_urgency: [{max_delay_seconds: 300, method_types: ['slack']}],
low_urgency: [{max_delay_seconds: 300, method_types: ['slack']}]
},
policy_type: 'follow_up',
post_mortem: {
due_date_config: {
applies_from: '2021-08-17T13:28:57.801578Z',
calculation_timezone: 'Europe/London',
calculation_type: 'weekdays',
days: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
},
incident_timestamp_id: '01FCNDV6P870EA6S7TK1DSYDG0'
},
requirements: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
run_on_private_incidents: false
},
schedule: {evaluation_level: 'schedule', requirement_type: 'contiguous'},
status: 'enabled'
})
};
fetch('https://api.incident.io/v2/policies', 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/policies",
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([
'assignment_rules' => [
'bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'reminder_detected_date_offset_hours' => [
0,
48
],
'reminder_due_date_offset_hours' => [
-24,
0,
24
]
],
'conditions' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'debrief' => [
'due_date_config' => [
'applies_from' => '2021-08-17T13:28:57.801578Z',
'calculation_timezone' => 'Europe/London',
'calculation_type' => 'weekdays',
'days' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'incident_timestamp_id' => '01FCNDV6P870EA6S7TK1DSYDG0'
],
'requirements' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'run_on_private_incidents' => false
],
'description' => 'All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.',
'expressions' => [
[
'else_branch' => [
'result' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'label' => 'Team Slack channel',
'operations' => [
[
'branches' => [
'branches' => [
[
'condition_groups' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'result' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
]
],
'returns' => [
'array' => true,
'type' => 'IncidentStatus'
]
],
'cast' => [
'returns' => [
'array' => true,
'type' => 'IncidentStatus'
]
],
'concatenate' => [
'reference' => 'catalog_attribute["01FCNDV6P870EA6S7TK1DSYD5H"]'
],
'filter' => [
'condition_groups' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
]
],
'navigate' => [
'reference' => 'catalog_attribute["01FCNDV6P870EA6S7TK1DSYD5H"]'
],
'operation_type' => 'navigate',
'parse' => [
'returns' => [
'array' => true,
'type' => 'IncidentStatus'
],
'source' => 'metadata.annotations["github.com/repo"]'
]
]
],
'reference' => 'abc123',
'root_reference' => 'incident.status'
]
],
'follow_up' => [
'due_date_config' => [
'applies_from' => '2021-08-17T13:28:57.801578Z',
'calculation_timezone' => 'Europe/London',
'calculation_type' => 'weekdays',
'days' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'incident_timestamp_id' => '01FCNDV6P870EA6S7TK1DSYDG0'
],
'requirements' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'run_on_private_incidents' => false
],
'name' => 'Critical incidents must export follow-ups',
'on_call_readiness' => [
'enforcement' => 'advisory',
'high_urgency' => [
[
'max_delay_seconds' => 300,
'method_types' => [
'slack'
]
]
],
'low_urgency' => [
[
'max_delay_seconds' => 300,
'method_types' => [
'slack'
]
]
]
],
'policy_type' => 'follow_up',
'post_mortem' => [
'due_date_config' => [
'applies_from' => '2021-08-17T13:28:57.801578Z',
'calculation_timezone' => 'Europe/London',
'calculation_type' => 'weekdays',
'days' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'incident_timestamp_id' => '01FCNDV6P870EA6S7TK1DSYDG0'
],
'requirements' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'run_on_private_incidents' => false
],
'schedule' => [
'evaluation_level' => 'schedule',
'requirement_type' => 'contiguous'
],
'status' => 'enabled'
]),
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/policies"
payload := strings.NewReader("{\n \"assignment_rules\": {\n \"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 \"reminder_detected_date_offset_hours\": [\n 0,\n 48\n ],\n \"reminder_due_date_offset_hours\": [\n -24,\n 0,\n 24\n ]\n },\n \"conditions\": [\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 \"debrief\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"description\": \"All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.\",\n \"expressions\": [\n {\n \"else_branch\": {\n \"result\": {\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 \"label\": \"Team Slack channel\",\n \"operations\": [\n {\n \"branches\": {\n \"branches\": [\n {\n \"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 \"result\": {\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 \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"cast\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"concatenate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"filter\": {\n \"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 },\n \"navigate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"operation_type\": \"navigate\",\n \"parse\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n },\n \"source\": \"metadata.annotations[\\\"github.com/repo\\\"]\"\n }\n }\n ],\n \"reference\": \"abc123\",\n \"root_reference\": \"incident.status\"\n }\n ],\n \"follow_up\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"name\": \"Critical incidents must export follow-ups\",\n \"on_call_readiness\": {\n \"enforcement\": \"advisory\",\n \"high_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ],\n \"low_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ]\n },\n \"policy_type\": \"follow_up\",\n \"post_mortem\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"schedule\": {\n \"evaluation_level\": \"schedule\",\n \"requirement_type\": \"contiguous\"\n },\n \"status\": \"enabled\"\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/policies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assignment_rules\": {\n \"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 \"reminder_detected_date_offset_hours\": [\n 0,\n 48\n ],\n \"reminder_due_date_offset_hours\": [\n -24,\n 0,\n 24\n ]\n },\n \"conditions\": [\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 \"debrief\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"description\": \"All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.\",\n \"expressions\": [\n {\n \"else_branch\": {\n \"result\": {\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 \"label\": \"Team Slack channel\",\n \"operations\": [\n {\n \"branches\": {\n \"branches\": [\n {\n \"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 \"result\": {\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 \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"cast\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"concatenate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"filter\": {\n \"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 },\n \"navigate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"operation_type\": \"navigate\",\n \"parse\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n },\n \"source\": \"metadata.annotations[\\\"github.com/repo\\\"]\"\n }\n }\n ],\n \"reference\": \"abc123\",\n \"root_reference\": \"incident.status\"\n }\n ],\n \"follow_up\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"name\": \"Critical incidents must export follow-ups\",\n \"on_call_readiness\": {\n \"enforcement\": \"advisory\",\n \"high_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ],\n \"low_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ]\n },\n \"policy_type\": \"follow_up\",\n \"post_mortem\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"schedule\": {\n \"evaluation_level\": \"schedule\",\n \"requirement_type\": \"contiguous\"\n },\n \"status\": \"enabled\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/policies")
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 \"assignment_rules\": {\n \"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 \"reminder_detected_date_offset_hours\": [\n 0,\n 48\n ],\n \"reminder_due_date_offset_hours\": [\n -24,\n 0,\n 24\n ]\n },\n \"conditions\": [\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 \"debrief\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"description\": \"All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.\",\n \"expressions\": [\n {\n \"else_branch\": {\n \"result\": {\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 \"label\": \"Team Slack channel\",\n \"operations\": [\n {\n \"branches\": {\n \"branches\": [\n {\n \"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 \"result\": {\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 \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"cast\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"concatenate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"filter\": {\n \"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 },\n \"navigate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"operation_type\": \"navigate\",\n \"parse\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n },\n \"source\": \"metadata.annotations[\\\"github.com/repo\\\"]\"\n }\n }\n ],\n \"reference\": \"abc123\",\n \"root_reference\": \"incident.status\"\n }\n ],\n \"follow_up\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"name\": \"Critical incidents must export follow-ups\",\n \"on_call_readiness\": {\n \"enforcement\": \"advisory\",\n \"high_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ],\n \"low_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ]\n },\n \"policy_type\": \"follow_up\",\n \"post_mortem\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"schedule\": {\n \"evaluation_level\": \"schedule\",\n \"requirement_type\": \"contiguous\"\n },\n \"status\": \"enabled\"\n}"
response = http.request(request)
puts response.read_body{
"policy": {
"assignment_rules": {
"bindings": [
{
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"reminder_detected_date_offset_hours": [
0,
48
],
"reminder_due_date_offset_hours": [
-24,
0,
24
]
},
"conditions": [
{
"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"
}
}
]
}
],
"created_at": "2021-08-17T13:28:57.801578Z",
"debrief": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"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"
}
}
]
}
],
"run_on_private_incidents": false
},
"description": "All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.",
"expressions": [
{
"else_branch": {
"result": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
},
"label": "Team Slack channel",
"operations": [
{
"branches": {
"branches": [
{
"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"
}
}
]
}
],
"result": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"returns": {
"array": true,
"type": "IncidentStatus"
}
},
"cast": {
"returns": {
"array": true,
"type": "IncidentStatus"
}
},
"concatenate": {
"reference": "1235",
"reference_label": "Teams"
},
"filter": {
"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"
}
}
]
}
]
},
"navigate": {
"reference": "1235",
"reference_label": "Teams"
},
"operation_type": "navigate",
"parse": {
"returns": {
"array": true,
"type": "IncidentStatus"
},
"source": "metadata.annotations[\"github.com/repo\"]"
},
"returns": {
"array": true,
"type": "IncidentStatus"
}
}
],
"reference": "abc123",
"returns": {
"array": true,
"type": "IncidentStatus"
},
"root_reference": "incident.status"
}
],
"follow_up": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"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"
}
}
]
}
],
"run_on_private_incidents": false
},
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Critical incidents must export follow-ups",
"on_call_readiness": {
"enforcement": "advisory",
"high_urgency": [
{
"max_delay_seconds": 300,
"method_types": [
"slack"
]
}
],
"low_urgency": [
{
"max_delay_seconds": 300,
"method_types": [
"slack"
]
}
]
},
"policy_type": "follow_up",
"post_mortem": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"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"
}
}
]
}
],
"run_on_private_incidents": false
},
"schedule": {
"evaluation_level": "schedule",
"requirement_type": "contiguous"
},
"status": "enabled",
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}policies.create scope.Authorizations
API key from your incident.io dashboard (Settings → API keys)
Body
Conditions which determine which resources are in scope for this policy
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"
}
]
}
]
Human readable description of the policy
"All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure."
Human readable name of the policy
"Critical incidents must export follow-ups"
Type of the policy, specifying what this applies to. Cannot be changed after the policy is created.
debrief, follow_up, on_call_readiness, post_mortem, schedule, vacation_conflict "follow_up"
Show child attributes
Show child attributes
{
"bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"reminder_detected_date_offset_hours": [0, 48],
"reminder_due_date_offset_hours": [-24, 0, 24]
}
Set when policy_type is debrief.
Show child attributes
Show child attributes
{
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"run_on_private_incidents": false
}
The expressions to use in this policy
Show child attributes
Show child attributes
[
{
"else_branch": {
"result": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
},
"label": "Team Slack channel",
"operations": [
{
"branches": {
"branches": [
{
"condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"result": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"returns": { "array": true, "type": "IncidentStatus" }
},
"cast": {
"returns": { "array": true, "type": "IncidentStatus" }
},
"concatenate": {
"reference": "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]"
},
"filter": {
"condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
]
},
"navigate": {
"reference": "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]"
},
"operation_type": "navigate",
"parse": {
"returns": { "array": true, "type": "IncidentStatus" },
"source": "metadata.annotations[\"github.com/repo\"]"
}
}
],
"reference": "abc123",
"root_reference": "incident.status"
}
]
Set when policy_type is follow_up.
Show child attributes
Show child attributes
{
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"run_on_private_incidents": false
}
Set when policy_type is on_call_readiness. The assignee is always the user in violation and cannot be configured.
Show child attributes
Show child attributes
{
"enforcement": "advisory",
"high_urgency": [
{
"max_delay_seconds": 300,
"method_types": ["slack"]
}
],
"low_urgency": [
{
"max_delay_seconds": 300,
"method_types": ["slack"]
}
]
}
Set when policy_type is post_mortem.
Show child attributes
Show child attributes
{
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"run_on_private_incidents": false
}
Detects gaps in on-call coverage. Set when policy_type is schedule.
Show child attributes
Show child attributes
{
"evaluation_level": "schedule",
"requirement_type": "contiguous"
}
Defaults to enabled on create. Settable on update — there is no separate disable endpoint.
enabled, disabled "enabled"
Response
Created response.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.incident.io/v2/policies \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"assignment_rules": {
"bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"reminder_detected_date_offset_hours": [
0,
48
],
"reminder_due_date_offset_hours": [
-24,
0,
24
]
},
"conditions": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"debrief": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"run_on_private_incidents": false
},
"description": "All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.",
"expressions": [
{
"else_branch": {
"result": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
},
"label": "Team Slack channel",
"operations": [
{
"branches": {
"branches": [
{
"condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"result": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"returns": {
"array": true,
"type": "IncidentStatus"
}
},
"cast": {
"returns": {
"array": true,
"type": "IncidentStatus"
}
},
"concatenate": {
"reference": "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]"
},
"filter": {
"condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
]
},
"navigate": {
"reference": "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]"
},
"operation_type": "navigate",
"parse": {
"returns": {
"array": true,
"type": "IncidentStatus"
},
"source": "metadata.annotations[\"github.com/repo\"]"
}
}
],
"reference": "abc123",
"root_reference": "incident.status"
}
],
"follow_up": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"run_on_private_incidents": false
},
"name": "Critical incidents must export follow-ups",
"on_call_readiness": {
"enforcement": "advisory",
"high_urgency": [
{
"max_delay_seconds": 300,
"method_types": [
"slack"
]
}
],
"low_urgency": [
{
"max_delay_seconds": 300,
"method_types": [
"slack"
]
}
]
},
"policy_type": "follow_up",
"post_mortem": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"run_on_private_incidents": false
},
"schedule": {
"evaluation_level": "schedule",
"requirement_type": "contiguous"
},
"status": "enabled"
}
'import requests
url = "https://api.incident.io/v2/policies"
payload = {
"assignment_rules": {
"bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"reminder_detected_date_offset_hours": [0, 48],
"reminder_due_date_offset_hours": [-24, 0, 24]
},
"conditions": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"debrief": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"run_on_private_incidents": False
},
"description": "All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.",
"expressions": [
{
"else_branch": { "result": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
} },
"label": "Team Slack channel",
"operations": [
{
"branches": {
"branches": [
{
"condition_groups": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"result": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"returns": {
"array": True,
"type": "IncidentStatus"
}
},
"cast": { "returns": {
"array": True,
"type": "IncidentStatus"
} },
"concatenate": { "reference": "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]" },
"filter": { "condition_groups": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }] },
"navigate": { "reference": "catalog_attribute[\"01FCNDV6P870EA6S7TK1DSYD5H\"]" },
"operation_type": "navigate",
"parse": {
"returns": {
"array": True,
"type": "IncidentStatus"
},
"source": "metadata.annotations[\"github.com/repo\"]"
}
}
],
"reference": "abc123",
"root_reference": "incident.status"
}
],
"follow_up": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"run_on_private_incidents": False
},
"name": "Critical incidents must export follow-ups",
"on_call_readiness": {
"enforcement": "advisory",
"high_urgency": [
{
"max_delay_seconds": 300,
"method_types": ["slack"]
}
],
"low_urgency": [
{
"max_delay_seconds": 300,
"method_types": ["slack"]
}
]
},
"policy_type": "follow_up",
"post_mortem": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"run_on_private_incidents": False
},
"schedule": {
"evaluation_level": "schedule",
"requirement_type": "contiguous"
},
"status": "enabled"
}
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({
assignment_rules: {
bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
reminder_detected_date_offset_hours: [0, 48],
reminder_due_date_offset_hours: [-24, 0, 24]
},
conditions: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
debrief: {
due_date_config: {
applies_from: '2021-08-17T13:28:57.801578Z',
calculation_timezone: 'Europe/London',
calculation_type: 'weekdays',
days: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
},
incident_timestamp_id: '01FCNDV6P870EA6S7TK1DSYDG0'
},
requirements: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
run_on_private_incidents: false
},
description: 'All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.',
expressions: [
{
else_branch: {
result: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
},
label: 'Team Slack channel',
operations: [
{
branches: {
branches: [
{
condition_groups: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
result: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
}
],
returns: {array: true, type: 'IncidentStatus'}
},
cast: {returns: {array: true, type: 'IncidentStatus'}},
concatenate: {reference: 'catalog_attribute["01FCNDV6P870EA6S7TK1DSYD5H"]'},
filter: {
condition_groups: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
]
},
navigate: {reference: 'catalog_attribute["01FCNDV6P870EA6S7TK1DSYD5H"]'},
operation_type: 'navigate',
parse: {
returns: {array: true, type: 'IncidentStatus'},
source: 'metadata.annotations["github.com/repo"]'
}
}
],
reference: 'abc123',
root_reference: 'incident.status'
}
],
follow_up: {
due_date_config: {
applies_from: '2021-08-17T13:28:57.801578Z',
calculation_timezone: 'Europe/London',
calculation_type: 'weekdays',
days: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
},
incident_timestamp_id: '01FCNDV6P870EA6S7TK1DSYDG0'
},
requirements: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
run_on_private_incidents: false
},
name: 'Critical incidents must export follow-ups',
on_call_readiness: {
enforcement: 'advisory',
high_urgency: [{max_delay_seconds: 300, method_types: ['slack']}],
low_urgency: [{max_delay_seconds: 300, method_types: ['slack']}]
},
policy_type: 'follow_up',
post_mortem: {
due_date_config: {
applies_from: '2021-08-17T13:28:57.801578Z',
calculation_timezone: 'Europe/London',
calculation_type: 'weekdays',
days: {
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
},
incident_timestamp_id: '01FCNDV6P870EA6S7TK1DSYDG0'
},
requirements: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
run_on_private_incidents: false
},
schedule: {evaluation_level: 'schedule', requirement_type: 'contiguous'},
status: 'enabled'
})
};
fetch('https://api.incident.io/v2/policies', 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/policies",
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([
'assignment_rules' => [
'bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'reminder_detected_date_offset_hours' => [
0,
48
],
'reminder_due_date_offset_hours' => [
-24,
0,
24
]
],
'conditions' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'debrief' => [
'due_date_config' => [
'applies_from' => '2021-08-17T13:28:57.801578Z',
'calculation_timezone' => 'Europe/London',
'calculation_type' => 'weekdays',
'days' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'incident_timestamp_id' => '01FCNDV6P870EA6S7TK1DSYDG0'
],
'requirements' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'run_on_private_incidents' => false
],
'description' => 'All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.',
'expressions' => [
[
'else_branch' => [
'result' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'label' => 'Team Slack channel',
'operations' => [
[
'branches' => [
'branches' => [
[
'condition_groups' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'result' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
]
],
'returns' => [
'array' => true,
'type' => 'IncidentStatus'
]
],
'cast' => [
'returns' => [
'array' => true,
'type' => 'IncidentStatus'
]
],
'concatenate' => [
'reference' => 'catalog_attribute["01FCNDV6P870EA6S7TK1DSYD5H"]'
],
'filter' => [
'condition_groups' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
]
],
'navigate' => [
'reference' => 'catalog_attribute["01FCNDV6P870EA6S7TK1DSYD5H"]'
],
'operation_type' => 'navigate',
'parse' => [
'returns' => [
'array' => true,
'type' => 'IncidentStatus'
],
'source' => 'metadata.annotations["github.com/repo"]'
]
]
],
'reference' => 'abc123',
'root_reference' => 'incident.status'
]
],
'follow_up' => [
'due_date_config' => [
'applies_from' => '2021-08-17T13:28:57.801578Z',
'calculation_timezone' => 'Europe/London',
'calculation_type' => 'weekdays',
'days' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'incident_timestamp_id' => '01FCNDV6P870EA6S7TK1DSYDG0'
],
'requirements' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'run_on_private_incidents' => false
],
'name' => 'Critical incidents must export follow-ups',
'on_call_readiness' => [
'enforcement' => 'advisory',
'high_urgency' => [
[
'max_delay_seconds' => 300,
'method_types' => [
'slack'
]
]
],
'low_urgency' => [
[
'max_delay_seconds' => 300,
'method_types' => [
'slack'
]
]
]
],
'policy_type' => 'follow_up',
'post_mortem' => [
'due_date_config' => [
'applies_from' => '2021-08-17T13:28:57.801578Z',
'calculation_timezone' => 'Europe/London',
'calculation_type' => 'weekdays',
'days' => [
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'incident_timestamp_id' => '01FCNDV6P870EA6S7TK1DSYDG0'
],
'requirements' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'run_on_private_incidents' => false
],
'schedule' => [
'evaluation_level' => 'schedule',
'requirement_type' => 'contiguous'
],
'status' => 'enabled'
]),
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/policies"
payload := strings.NewReader("{\n \"assignment_rules\": {\n \"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 \"reminder_detected_date_offset_hours\": [\n 0,\n 48\n ],\n \"reminder_due_date_offset_hours\": [\n -24,\n 0,\n 24\n ]\n },\n \"conditions\": [\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 \"debrief\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"description\": \"All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.\",\n \"expressions\": [\n {\n \"else_branch\": {\n \"result\": {\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 \"label\": \"Team Slack channel\",\n \"operations\": [\n {\n \"branches\": {\n \"branches\": [\n {\n \"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 \"result\": {\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 \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"cast\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"concatenate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"filter\": {\n \"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 },\n \"navigate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"operation_type\": \"navigate\",\n \"parse\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n },\n \"source\": \"metadata.annotations[\\\"github.com/repo\\\"]\"\n }\n }\n ],\n \"reference\": \"abc123\",\n \"root_reference\": \"incident.status\"\n }\n ],\n \"follow_up\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"name\": \"Critical incidents must export follow-ups\",\n \"on_call_readiness\": {\n \"enforcement\": \"advisory\",\n \"high_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ],\n \"low_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ]\n },\n \"policy_type\": \"follow_up\",\n \"post_mortem\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"schedule\": {\n \"evaluation_level\": \"schedule\",\n \"requirement_type\": \"contiguous\"\n },\n \"status\": \"enabled\"\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/policies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"assignment_rules\": {\n \"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 \"reminder_detected_date_offset_hours\": [\n 0,\n 48\n ],\n \"reminder_due_date_offset_hours\": [\n -24,\n 0,\n 24\n ]\n },\n \"conditions\": [\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 \"debrief\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"description\": \"All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.\",\n \"expressions\": [\n {\n \"else_branch\": {\n \"result\": {\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 \"label\": \"Team Slack channel\",\n \"operations\": [\n {\n \"branches\": {\n \"branches\": [\n {\n \"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 \"result\": {\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 \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"cast\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"concatenate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"filter\": {\n \"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 },\n \"navigate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"operation_type\": \"navigate\",\n \"parse\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n },\n \"source\": \"metadata.annotations[\\\"github.com/repo\\\"]\"\n }\n }\n ],\n \"reference\": \"abc123\",\n \"root_reference\": \"incident.status\"\n }\n ],\n \"follow_up\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"name\": \"Critical incidents must export follow-ups\",\n \"on_call_readiness\": {\n \"enforcement\": \"advisory\",\n \"high_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ],\n \"low_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ]\n },\n \"policy_type\": \"follow_up\",\n \"post_mortem\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"schedule\": {\n \"evaluation_level\": \"schedule\",\n \"requirement_type\": \"contiguous\"\n },\n \"status\": \"enabled\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/policies")
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 \"assignment_rules\": {\n \"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 \"reminder_detected_date_offset_hours\": [\n 0,\n 48\n ],\n \"reminder_due_date_offset_hours\": [\n -24,\n 0,\n 24\n ]\n },\n \"conditions\": [\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 \"debrief\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"description\": \"All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.\",\n \"expressions\": [\n {\n \"else_branch\": {\n \"result\": {\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 \"label\": \"Team Slack channel\",\n \"operations\": [\n {\n \"branches\": {\n \"branches\": [\n {\n \"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 \"result\": {\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 \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"cast\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n }\n },\n \"concatenate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"filter\": {\n \"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 },\n \"navigate\": {\n \"reference\": \"catalog_attribute[\\\"01FCNDV6P870EA6S7TK1DSYD5H\\\"]\"\n },\n \"operation_type\": \"navigate\",\n \"parse\": {\n \"returns\": {\n \"array\": true,\n \"type\": \"IncidentStatus\"\n },\n \"source\": \"metadata.annotations[\\\"github.com/repo\\\"]\"\n }\n }\n ],\n \"reference\": \"abc123\",\n \"root_reference\": \"incident.status\"\n }\n ],\n \"follow_up\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"name\": \"Critical incidents must export follow-ups\",\n \"on_call_readiness\": {\n \"enforcement\": \"advisory\",\n \"high_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ],\n \"low_urgency\": [\n {\n \"max_delay_seconds\": 300,\n \"method_types\": [\n \"slack\"\n ]\n }\n ]\n },\n \"policy_type\": \"follow_up\",\n \"post_mortem\": {\n \"due_date_config\": {\n \"applies_from\": \"2021-08-17T13:28:57.801578Z\",\n \"calculation_timezone\": \"Europe/London\",\n \"calculation_type\": \"weekdays\",\n \"days\": {\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 \"incident_timestamp_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\"\n },\n \"requirements\": [\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 \"run_on_private_incidents\": false\n },\n \"schedule\": {\n \"evaluation_level\": \"schedule\",\n \"requirement_type\": \"contiguous\"\n },\n \"status\": \"enabled\"\n}"
response = http.request(request)
puts response.read_body{
"policy": {
"assignment_rules": {
"bindings": [
{
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"reminder_detected_date_offset_hours": [
0,
48
],
"reminder_due_date_offset_hours": [
-24,
0,
24
]
},
"conditions": [
{
"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"
}
}
]
}
],
"created_at": "2021-08-17T13:28:57.801578Z",
"debrief": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"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"
}
}
]
}
],
"run_on_private_incidents": false
},
"description": "All critical incidents must export follow-ups to an external issue tracker before 7 days has passed since closure.",
"expressions": [
{
"else_branch": {
"result": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
},
"label": "Team Slack channel",
"operations": [
{
"branches": {
"branches": [
{
"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"
}
}
]
}
],
"result": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
}
],
"returns": {
"array": true,
"type": "IncidentStatus"
}
},
"cast": {
"returns": {
"array": true,
"type": "IncidentStatus"
}
},
"concatenate": {
"reference": "1235",
"reference_label": "Teams"
},
"filter": {
"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"
}
}
]
}
]
},
"navigate": {
"reference": "1235",
"reference_label": "Teams"
},
"operation_type": "navigate",
"parse": {
"returns": {
"array": true,
"type": "IncidentStatus"
},
"source": "metadata.annotations[\"github.com/repo\"]"
},
"returns": {
"array": true,
"type": "IncidentStatus"
}
}
],
"reference": "abc123",
"returns": {
"array": true,
"type": "IncidentStatus"
},
"root_reference": "incident.status"
}
],
"follow_up": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"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"
}
}
]
}
],
"run_on_private_incidents": false
},
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Critical incidents must export follow-ups",
"on_call_readiness": {
"enforcement": "advisory",
"high_urgency": [
{
"max_delay_seconds": 300,
"method_types": [
"slack"
]
}
],
"low_urgency": [
{
"max_delay_seconds": 300,
"method_types": [
"slack"
]
}
]
},
"policy_type": "follow_up",
"post_mortem": {
"due_date_config": {
"applies_from": "2021-08-17T13:28:57.801578Z",
"calculation_timezone": "Europe/London",
"calculation_type": "weekdays",
"days": {
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
},
"incident_timestamp_id": "01FCNDV6P870EA6S7TK1DSYDG0"
},
"requirements": [
{
"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"
}
}
]
}
],
"run_on_private_incidents": false
},
"schedule": {
"evaluation_level": "schedule",
"requirement_type": "contiguous"
},
"status": "enabled",
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}{
"debug": {
"message": "Something broke: and something else: and something else",
"stacktrace": [
"thing.go:123"
]
},
"errors": [
{
"code": "trial_expired",
"message": "Default incident call link must be a valid URL",
"metadata": {
"abc123": "abc123"
},
"source": {
"field": "default_call_url",
"pointer": "/settings/default_call_url"
}
}
],
"rate_limit": {
"limit": 100,
"name": "client_ip",
"remaining": 98,
"retry_after": "2020-01-01T00:00:00Z"
},
"request_id": "2T1p0e3j",
"status": 408,
"type": "invalid_request_error"
}