Create
Create a new alert attribute.
POST
/
v2
/
alert_attributes
Create
curl --request POST \
--url https://api.incident.io/v2/alert_attributes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"array": false,
"emoji": "fire",
"name": "service",
"required": false,
"type": "CatalogEntry[\"01GW2G3V0S59R238FAHPDS1R67\"]"
}
'import requests
url = "https://api.incident.io/v2/alert_attributes"
payload = {
"array": False,
"emoji": "fire",
"name": "service",
"required": False,
"type": "CatalogEntry[\"01GW2G3V0S59R238FAHPDS1R67\"]"
}
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({
array: false,
emoji: 'fire',
name: 'service',
required: false,
type: 'CatalogEntry["01GW2G3V0S59R238FAHPDS1R67"]'
})
};
fetch('https://api.incident.io/v2/alert_attributes', 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/alert_attributes",
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([
'array' => false,
'emoji' => 'fire',
'name' => 'service',
'required' => false,
'type' => 'CatalogEntry["01GW2G3V0S59R238FAHPDS1R67"]'
]),
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/alert_attributes"
payload := strings.NewReader("{\n \"array\": false,\n \"emoji\": \"fire\",\n \"name\": \"service\",\n \"required\": false,\n \"type\": \"CatalogEntry[\\\"01GW2G3V0S59R238FAHPDS1R67\\\"]\"\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/alert_attributes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"array\": false,\n \"emoji\": \"fire\",\n \"name\": \"service\",\n \"required\": false,\n \"type\": \"CatalogEntry[\\\"01GW2G3V0S59R238FAHPDS1R67\\\"]\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/alert_attributes")
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 \"array\": false,\n \"emoji\": \"fire\",\n \"name\": \"service\",\n \"required\": false,\n \"type\": \"CatalogEntry[\\\"01GW2G3V0S59R238FAHPDS1R67\\\"]\"\n}"
response = http.request(request)
puts response.read_body{
"alert_attribute": {
"array": false,
"emoji": "fire",
"id": "01GW2G3V0S59R238FAHPDS1R66",
"name": "service",
"required": false,
"type": "CatalogEntry[\"01GW2G3V0S59R238FAHPDS1R67\"]"
}
}🔑 Requires the
alert_schema.update scope.Authorizations
API key from your incident.io dashboard (Settings → API keys)
Body
application/json
Whether this attribute is an array
Example:
false
Unique name of this attribute
Example:
"service"
Engine resource name for this attribute
Example:
"CatalogEntry[\"01GW2G3V0S59R238FAHPDS1R67\"]"
The emoji to display alongside this attribute in chat messages, stored without colons
Example:
"fire"
Whether this attribute is required. If this field is not set, the existing setting will be preserved.
Example:
false
Response
201 - application/json
Created response.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
Create
curl --request POST \
--url https://api.incident.io/v2/alert_attributes \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"array": false,
"emoji": "fire",
"name": "service",
"required": false,
"type": "CatalogEntry[\"01GW2G3V0S59R238FAHPDS1R67\"]"
}
'import requests
url = "https://api.incident.io/v2/alert_attributes"
payload = {
"array": False,
"emoji": "fire",
"name": "service",
"required": False,
"type": "CatalogEntry[\"01GW2G3V0S59R238FAHPDS1R67\"]"
}
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({
array: false,
emoji: 'fire',
name: 'service',
required: false,
type: 'CatalogEntry["01GW2G3V0S59R238FAHPDS1R67"]'
})
};
fetch('https://api.incident.io/v2/alert_attributes', 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/alert_attributes",
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([
'array' => false,
'emoji' => 'fire',
'name' => 'service',
'required' => false,
'type' => 'CatalogEntry["01GW2G3V0S59R238FAHPDS1R67"]'
]),
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/alert_attributes"
payload := strings.NewReader("{\n \"array\": false,\n \"emoji\": \"fire\",\n \"name\": \"service\",\n \"required\": false,\n \"type\": \"CatalogEntry[\\\"01GW2G3V0S59R238FAHPDS1R67\\\"]\"\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/alert_attributes")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"array\": false,\n \"emoji\": \"fire\",\n \"name\": \"service\",\n \"required\": false,\n \"type\": \"CatalogEntry[\\\"01GW2G3V0S59R238FAHPDS1R67\\\"]\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/alert_attributes")
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 \"array\": false,\n \"emoji\": \"fire\",\n \"name\": \"service\",\n \"required\": false,\n \"type\": \"CatalogEntry[\\\"01GW2G3V0S59R238FAHPDS1R67\\\"]\"\n}"
response = http.request(request)
puts response.read_body{
"alert_attribute": {
"array": false,
"emoji": "fire",
"id": "01GW2G3V0S59R238FAHPDS1R66",
"name": "service",
"required": false,
"type": "CatalogEntry[\"01GW2G3V0S59R238FAHPDS1R67\"]"
}
}