Update
Update the details of a custom field
curl --request PUT \
--url https://api.incident.io/v1/custom_fields/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Which team is impacted by this issue",
"name": "Affected Team",
"required": "never",
"required_v2": "never",
"show_before_closure": true,
"show_before_creation": true,
"show_before_update": true,
"show_in_announcement_post": true
}
'import requests
url = "https://api.incident.io/v1/custom_fields/{id}"
payload = {
"description": "Which team is impacted by this issue",
"name": "Affected Team",
"required": "never",
"required_v2": "never",
"show_before_closure": True,
"show_before_creation": True,
"show_before_update": True,
"show_in_announcement_post": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'Which team is impacted by this issue',
name: 'Affected Team',
required: 'never',
required_v2: 'never',
show_before_closure: true,
show_before_creation: true,
show_before_update: true,
show_in_announcement_post: true
})
};
fetch('https://api.incident.io/v1/custom_fields/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.incident.io/v1/custom_fields/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => 'Which team is impacted by this issue',
'name' => 'Affected Team',
'required' => 'never',
'required_v2' => 'never',
'show_before_closure' => true,
'show_before_creation' => true,
'show_before_update' => true,
'show_in_announcement_post' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.incident.io/v1/custom_fields/{id}"
payload := strings.NewReader("{\n \"description\": \"Which team is impacted by this issue\",\n \"name\": \"Affected Team\",\n \"required\": \"never\",\n \"required_v2\": \"never\",\n \"show_before_closure\": true,\n \"show_before_creation\": true,\n \"show_before_update\": true,\n \"show_in_announcement_post\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.incident.io/v1/custom_fields/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Which team is impacted by this issue\",\n \"name\": \"Affected Team\",\n \"required\": \"never\",\n \"required_v2\": \"never\",\n \"show_before_closure\": true,\n \"show_before_creation\": true,\n \"show_before_update\": true,\n \"show_in_announcement_post\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v1/custom_fields/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Which team is impacted by this issue\",\n \"name\": \"Affected Team\",\n \"required\": \"never\",\n \"required_v2\": \"never\",\n \"show_before_closure\": true,\n \"show_before_creation\": true,\n \"show_before_update\": true,\n \"show_in_announcement_post\": true\n}"
response = http.request(request)
puts response.read_body{
"custom_field": {
"catalog_type_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Which team is impacted by this issue",
"field_type": "single_select",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Affected Team",
"options": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"sort_key": 10,
"value": "Product"
}
],
"required": "never",
"required_v2": "never",
"show_before_closure": true,
"show_before_creation": true,
"show_before_update": true,
"show_in_announcement_post": true,
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}organisation_settings.update scope.Authorizations
API key from your incident.io dashboard (Settings → API keys)
Path Parameters
Unique identifier for the custom field
"01FCNDV6P870EA6S7TK1DSYDG0"
Body
Description of the custom field
"Which team is impacted by this issue"
Human readable name for the custom field
50"Affected Team"
Whether a custom field should be shown in the incident resolve modal. If this custom field is required before resolution, but no value has been set for it, the field will be shown in the resolve modal whatever the value of this setting.
true
Whether a custom field should be shown in the incident creation modal. This must be true if the field is always required.
true
Whether a custom field should be shown in the incident update modal.
true
When this custom field must be set during the incident lifecycle. [DEPRECATED: please use required_v2 instead].
never, before_closure, always "never"
When this custom field must be set during the incident lifecycle.
never, before_resolution, always "never"
Whether a custom field should be shown in the list of fields as part of the announcement post when set.
true
Response
OK response.
Show child attributes
Show child attributes
{
"catalog_type_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Which team is impacted by this issue",
"field_type": "single_select",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Affected Team",
"options": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"sort_key": 10,
"value": "Product"
}
],
"required": "never",
"required_v2": "never",
"show_before_closure": true,
"show_before_creation": true,
"show_before_update": true,
"show_in_announcement_post": true,
"updated_at": "2021-08-17T13:28:57.801578Z"
}
Was this page helpful?
curl --request PUT \
--url https://api.incident.io/v1/custom_fields/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Which team is impacted by this issue",
"name": "Affected Team",
"required": "never",
"required_v2": "never",
"show_before_closure": true,
"show_before_creation": true,
"show_before_update": true,
"show_in_announcement_post": true
}
'import requests
url = "https://api.incident.io/v1/custom_fields/{id}"
payload = {
"description": "Which team is impacted by this issue",
"name": "Affected Team",
"required": "never",
"required_v2": "never",
"show_before_closure": True,
"show_before_creation": True,
"show_before_update": True,
"show_in_announcement_post": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
description: 'Which team is impacted by this issue',
name: 'Affected Team',
required: 'never',
required_v2: 'never',
show_before_closure: true,
show_before_creation: true,
show_before_update: true,
show_in_announcement_post: true
})
};
fetch('https://api.incident.io/v1/custom_fields/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.incident.io/v1/custom_fields/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'description' => 'Which team is impacted by this issue',
'name' => 'Affected Team',
'required' => 'never',
'required_v2' => 'never',
'show_before_closure' => true,
'show_before_creation' => true,
'show_before_update' => true,
'show_in_announcement_post' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.incident.io/v1/custom_fields/{id}"
payload := strings.NewReader("{\n \"description\": \"Which team is impacted by this issue\",\n \"name\": \"Affected Team\",\n \"required\": \"never\",\n \"required_v2\": \"never\",\n \"show_before_closure\": true,\n \"show_before_creation\": true,\n \"show_before_update\": true,\n \"show_in_announcement_post\": true\n}")
req, _ := http.NewRequest("PUT", 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.put("https://api.incident.io/v1/custom_fields/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"description\": \"Which team is impacted by this issue\",\n \"name\": \"Affected Team\",\n \"required\": \"never\",\n \"required_v2\": \"never\",\n \"show_before_closure\": true,\n \"show_before_creation\": true,\n \"show_before_update\": true,\n \"show_in_announcement_post\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v1/custom_fields/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"description\": \"Which team is impacted by this issue\",\n \"name\": \"Affected Team\",\n \"required\": \"never\",\n \"required_v2\": \"never\",\n \"show_before_closure\": true,\n \"show_before_creation\": true,\n \"show_before_update\": true,\n \"show_in_announcement_post\": true\n}"
response = http.request(request)
puts response.read_body{
"custom_field": {
"catalog_type_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"created_at": "2021-08-17T13:28:57.801578Z",
"description": "Which team is impacted by this issue",
"field_type": "single_select",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Affected Team",
"options": [
{
"custom_field_id": "01FCNDV6P870EA6S7TK1DSYDG0",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"sort_key": 10,
"value": "Product"
}
],
"required": "never",
"required_v2": "never",
"show_before_closure": true,
"show_before_creation": true,
"show_before_update": true,
"show_in_announcement_post": true,
"updated_at": "2021-08-17T13:28:57.801578Z"
}
}