Create
Create an announcement rule.
curl --request POST \
--url https://api.incident.io/v2/announcement_rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"conditions_no_longer_apply_behaviour": "leave_in_place",
"microsoft_teams_channel_ids": [
"19:abc@thread.tacv2/19:def@thread.tacv2"
],
"mode": "live_and_closed",
"name": "Data Breaches",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"private_incident_scope": "all",
"slack_channel_ids": [
"C02AW36C1M5"
],
"template_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"update_sharing_mode": "none"
}
'import requests
url = "https://api.incident.io/v2/announcement_rules"
payload = {
"condition_groups": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"conditions_no_longer_apply_behaviour": "leave_in_place",
"microsoft_teams_channel_ids": ["19:abc@thread.tacv2/19:def@thread.tacv2"],
"mode": "live_and_closed",
"name": "Data Breaches",
"owning_team_ids": ["01G0J1EXE7AXZ2C93K61WBPYEH"],
"private_incident_scope": "all",
"slack_channel_ids": ["C02AW36C1M5"],
"template_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"update_sharing_mode": "none"
}
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({
condition_groups: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
conditions_no_longer_apply_behaviour: 'leave_in_place',
microsoft_teams_channel_ids: ['19:abc@thread.tacv2/19:def@thread.tacv2'],
mode: 'live_and_closed',
name: 'Data Breaches',
owning_team_ids: ['01G0J1EXE7AXZ2C93K61WBPYEH'],
private_incident_scope: 'all',
slack_channel_ids: ['C02AW36C1M5'],
template_id: '01FCNDV6P870EA6S7TK1DSYDG0',
update_sharing_mode: 'none'
})
};
fetch('https://api.incident.io/v2/announcement_rules', 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/announcement_rules",
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([
'condition_groups' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'conditions_no_longer_apply_behaviour' => 'leave_in_place',
'microsoft_teams_channel_ids' => [
'19:abc@thread.tacv2/19:def@thread.tacv2'
],
'mode' => 'live_and_closed',
'name' => 'Data Breaches',
'owning_team_ids' => [
'01G0J1EXE7AXZ2C93K61WBPYEH'
],
'private_incident_scope' => 'all',
'slack_channel_ids' => [
'C02AW36C1M5'
],
'template_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'update_sharing_mode' => 'none'
]),
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/announcement_rules"
payload := strings.NewReader("{\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 \"conditions_no_longer_apply_behaviour\": \"leave_in_place\",\n \"microsoft_teams_channel_ids\": [\n \"19:abc@thread.tacv2/19:def@thread.tacv2\"\n ],\n \"mode\": \"live_and_closed\",\n \"name\": \"Data Breaches\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"all\",\n \"slack_channel_ids\": [\n \"C02AW36C1M5\"\n ],\n \"template_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"update_sharing_mode\": \"none\"\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/announcement_rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\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 \"conditions_no_longer_apply_behaviour\": \"leave_in_place\",\n \"microsoft_teams_channel_ids\": [\n \"19:abc@thread.tacv2/19:def@thread.tacv2\"\n ],\n \"mode\": \"live_and_closed\",\n \"name\": \"Data Breaches\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"all\",\n \"slack_channel_ids\": [\n \"C02AW36C1M5\"\n ],\n \"template_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"update_sharing_mode\": \"none\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/announcement_rules")
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 \"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 \"conditions_no_longer_apply_behaviour\": \"leave_in_place\",\n \"microsoft_teams_channel_ids\": [\n \"19:abc@thread.tacv2/19:def@thread.tacv2\"\n ],\n \"mode\": \"live_and_closed\",\n \"name\": \"Data Breaches\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"all\",\n \"slack_channel_ids\": [\n \"C02AW36C1M5\"\n ],\n \"template_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"update_sharing_mode\": \"none\"\n}"
response = http.request(request)
puts response.read_body{
"announcement_rule": {
"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"
}
}
]
}
],
"conditions_no_longer_apply_behaviour": "leave_in_place",
"created_at": "2021-08-17T13:28:57.801578Z",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"microsoft_teams_channel_ids": [
"19:abc@thread.tacv2/19:def@thread.tacv2"
],
"mode": "live_and_closed",
"name": "Data Breaches",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"private_incident_scope": "all",
"slack_channel_ids": [
"C02AW36C1M5"
],
"template_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"update_sharing_mode": "none",
"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"
}announcement_rules.create scope.Authorizations
API key from your incident.io dashboard (Settings → API keys)
Body
Incidents are announced when they match any of these condition groups
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"
}
]
}
]
Which incidents are announced: live incidents only, or triage incidents too
live_and_closed, include_triage, include_triage_and_merged, include_declined_and_merged, include_all "live_and_closed"
Human readable name for the rule
"Data Breaches"
Where incident updates are shared once the incident is announced
none, thread, thread_and_channel "none"
Whether to remove announcement posts when the incident no longer matches this rule's conditions. Defaults to leaving them in place.
leave_in_place, remove "leave_in_place"
Microsoft Teams channels to post announcements into, as team_id/channel_id. Required when the organisation uses Microsoft Teams.
["19:abc@thread.tacv2/19:def@thread.tacv2"]
IDs of the teams that own this rule
["01G0J1EXE7AXZ2C93K61WBPYEH"]
Which private incidents this rule announces: every private incident (all), those an owning team can see (owning_teams), or none. Defaults to none on create, and is left unchanged on update when omitted.
all, owning_teams, none "all"
IDs of the Slack channels to post announcements into. Required when the organisation uses Slack.
["C02AW36C1M5"]
ID of the announcement template used to render this rule's posts. Defaults to the organisation's default template when omitted.
"01FCNDV6P870EA6S7TK1DSYDG0"
Response
Created response.
An announcement rule posts an announcement of matching incidents into one or more channels.
Show child attributes
Show child attributes
Was this page helpful?
curl --request POST \
--url https://api.incident.io/v2/announcement_rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"conditions_no_longer_apply_behaviour": "leave_in_place",
"microsoft_teams_channel_ids": [
"19:abc@thread.tacv2/19:def@thread.tacv2"
],
"mode": "live_and_closed",
"name": "Data Breaches",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"private_incident_scope": "all",
"slack_channel_ids": [
"C02AW36C1M5"
],
"template_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"update_sharing_mode": "none"
}
'import requests
url = "https://api.incident.io/v2/announcement_rules"
payload = {
"condition_groups": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"conditions_no_longer_apply_behaviour": "leave_in_place",
"microsoft_teams_channel_ids": ["19:abc@thread.tacv2/19:def@thread.tacv2"],
"mode": "live_and_closed",
"name": "Data Breaches",
"owning_team_ids": ["01G0J1EXE7AXZ2C93K61WBPYEH"],
"private_incident_scope": "all",
"slack_channel_ids": ["C02AW36C1M5"],
"template_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"update_sharing_mode": "none"
}
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({
condition_groups: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
conditions_no_longer_apply_behaviour: 'leave_in_place',
microsoft_teams_channel_ids: ['19:abc@thread.tacv2/19:def@thread.tacv2'],
mode: 'live_and_closed',
name: 'Data Breaches',
owning_team_ids: ['01G0J1EXE7AXZ2C93K61WBPYEH'],
private_incident_scope: 'all',
slack_channel_ids: ['C02AW36C1M5'],
template_id: '01FCNDV6P870EA6S7TK1DSYDG0',
update_sharing_mode: 'none'
})
};
fetch('https://api.incident.io/v2/announcement_rules', 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/announcement_rules",
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([
'condition_groups' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'conditions_no_longer_apply_behaviour' => 'leave_in_place',
'microsoft_teams_channel_ids' => [
'19:abc@thread.tacv2/19:def@thread.tacv2'
],
'mode' => 'live_and_closed',
'name' => 'Data Breaches',
'owning_team_ids' => [
'01G0J1EXE7AXZ2C93K61WBPYEH'
],
'private_incident_scope' => 'all',
'slack_channel_ids' => [
'C02AW36C1M5'
],
'template_id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'update_sharing_mode' => 'none'
]),
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/announcement_rules"
payload := strings.NewReader("{\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 \"conditions_no_longer_apply_behaviour\": \"leave_in_place\",\n \"microsoft_teams_channel_ids\": [\n \"19:abc@thread.tacv2/19:def@thread.tacv2\"\n ],\n \"mode\": \"live_and_closed\",\n \"name\": \"Data Breaches\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"all\",\n \"slack_channel_ids\": [\n \"C02AW36C1M5\"\n ],\n \"template_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"update_sharing_mode\": \"none\"\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/announcement_rules")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\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 \"conditions_no_longer_apply_behaviour\": \"leave_in_place\",\n \"microsoft_teams_channel_ids\": [\n \"19:abc@thread.tacv2/19:def@thread.tacv2\"\n ],\n \"mode\": \"live_and_closed\",\n \"name\": \"Data Breaches\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"all\",\n \"slack_channel_ids\": [\n \"C02AW36C1M5\"\n ],\n \"template_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"update_sharing_mode\": \"none\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/announcement_rules")
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 \"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 \"conditions_no_longer_apply_behaviour\": \"leave_in_place\",\n \"microsoft_teams_channel_ids\": [\n \"19:abc@thread.tacv2/19:def@thread.tacv2\"\n ],\n \"mode\": \"live_and_closed\",\n \"name\": \"Data Breaches\",\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"all\",\n \"slack_channel_ids\": [\n \"C02AW36C1M5\"\n ],\n \"template_id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"update_sharing_mode\": \"none\"\n}"
response = http.request(request)
puts response.read_body{
"announcement_rule": {
"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"
}
}
]
}
],
"conditions_no_longer_apply_behaviour": "leave_in_place",
"created_at": "2021-08-17T13:28:57.801578Z",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"microsoft_teams_channel_ids": [
"19:abc@thread.tacv2/19:def@thread.tacv2"
],
"mode": "live_and_closed",
"name": "Data Breaches",
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"private_incident_scope": "all",
"slack_channel_ids": [
"C02AW36C1M5"
],
"template_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"update_sharing_mode": "none",
"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"
}