Update
Updates a workflow
curl --request PUT \
--url https://api.incident.io/v2/workflows/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"annotations": {
"incident.io/terraform/version": "3.0.0"
},
"condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"continue_on_step_error": true,
"delay": {
"conditions_apply_over_delay": false,
"for_seconds": 60
},
"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"
}
],
"folder": "My folder 01",
"form_fields": [
{
"array": true,
"description": "The customer affected by this incident",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"key": "affected_customer",
"required": true,
"title": "Affected customer",
"type": "User"
}
],
"include_private_escalations": true,
"include_private_incidents": true,
"name": "My little workflow",
"once_for": [
"incident.url"
],
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"private_incident_scope": "owning_teams",
"runs_on_incident_modes": [
"standard",
"test",
"retrospective"
],
"runs_on_incidents": "newly_created",
"shortform": "page-the-ceo",
"skip_step_upgrades": false,
"state": "active",
"steps": [
{
"for_each": "abc123",
"id": "abc123",
"name": "pagerduty.escalate",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
]
}
]
}
'import requests
url = "https://api.incident.io/v2/workflows/{id}"
payload = {
"annotations": { "incident.io/terraform/version": "3.0.0" },
"condition_groups": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"continue_on_step_error": True,
"delay": {
"conditions_apply_over_delay": False,
"for_seconds": 60
},
"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"
}
],
"folder": "My folder 01",
"form_fields": [
{
"array": True,
"description": "The customer affected by this incident",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"key": "affected_customer",
"required": True,
"title": "Affected customer",
"type": "User"
}
],
"include_private_escalations": True,
"include_private_incidents": True,
"name": "My little workflow",
"once_for": ["incident.url"],
"owning_team_ids": ["01G0J1EXE7AXZ2C93K61WBPYEH"],
"private_incident_scope": "owning_teams",
"runs_on_incident_modes": ["standard", "test", "retrospective"],
"runs_on_incidents": "newly_created",
"shortform": "page-the-ceo",
"skip_step_upgrades": False,
"state": "active",
"steps": [
{
"for_each": "abc123",
"id": "abc123",
"name": "pagerduty.escalate",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
]
}
]
}
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({
annotations: {'incident.io/terraform/version': '3.0.0'},
condition_groups: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
continue_on_step_error: true,
delay: {conditions_apply_over_delay: false, for_seconds: 60},
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'
}
],
folder: 'My folder 01',
form_fields: [
{
array: true,
description: 'The customer affected by this incident',
id: '01FCNDV6P870EA6S7TK1DSYDG0',
key: 'affected_customer',
required: true,
title: 'Affected customer',
type: 'User'
}
],
include_private_escalations: true,
include_private_incidents: true,
name: 'My little workflow',
once_for: ['incident.url'],
owning_team_ids: ['01G0J1EXE7AXZ2C93K61WBPYEH'],
private_incident_scope: 'owning_teams',
runs_on_incident_modes: ['standard', 'test', 'retrospective'],
runs_on_incidents: 'newly_created',
shortform: 'page-the-ceo',
skip_step_upgrades: false,
state: 'active',
steps: [
{
for_each: 'abc123',
id: 'abc123',
name: 'pagerduty.escalate',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
]
}
]
})
};
fetch('https://api.incident.io/v2/workflows/{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/v2/workflows/{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([
'annotations' => [
'incident.io/terraform/version' => '3.0.0'
],
'condition_groups' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'continue_on_step_error' => true,
'delay' => [
'conditions_apply_over_delay' => false,
'for_seconds' => 60
],
'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'
]
],
'folder' => 'My folder 01',
'form_fields' => [
[
'array' => true,
'description' => 'The customer affected by this incident',
'id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'key' => 'affected_customer',
'required' => true,
'title' => 'Affected customer',
'type' => 'User'
]
],
'include_private_escalations' => true,
'include_private_incidents' => true,
'name' => 'My little workflow',
'once_for' => [
'incident.url'
],
'owning_team_ids' => [
'01G0J1EXE7AXZ2C93K61WBPYEH'
],
'private_incident_scope' => 'owning_teams',
'runs_on_incident_modes' => [
'standard',
'test',
'retrospective'
],
'runs_on_incidents' => 'newly_created',
'shortform' => 'page-the-ceo',
'skip_step_upgrades' => false,
'state' => 'active',
'steps' => [
[
'for_each' => 'abc123',
'id' => 'abc123',
'name' => 'pagerduty.escalate',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
]
]
]
]),
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/workflows/{id}"
payload := strings.NewReader("{\n \"annotations\": {\n \"incident.io/terraform/version\": \"3.0.0\"\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 \"continue_on_step_error\": true,\n \"delay\": {\n \"conditions_apply_over_delay\": false,\n \"for_seconds\": 60\n },\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 \"folder\": \"My folder 01\",\n \"form_fields\": [\n {\n \"array\": true,\n \"description\": \"The customer affected by this incident\",\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"key\": \"affected_customer\",\n \"required\": true,\n \"title\": \"Affected customer\",\n \"type\": \"User\"\n }\n ],\n \"include_private_escalations\": true,\n \"include_private_incidents\": true,\n \"name\": \"My little workflow\",\n \"once_for\": [\n \"incident.url\"\n ],\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"owning_teams\",\n \"runs_on_incident_modes\": [\n \"standard\",\n \"test\",\n \"retrospective\"\n ],\n \"runs_on_incidents\": \"newly_created\",\n \"shortform\": \"page-the-ceo\",\n \"skip_step_upgrades\": false,\n \"state\": \"active\",\n \"steps\": [\n {\n \"for_each\": \"abc123\",\n \"id\": \"abc123\",\n \"name\": \"pagerduty.escalate\",\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 }\n ]\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/v2/workflows/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"annotations\": {\n \"incident.io/terraform/version\": \"3.0.0\"\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 \"continue_on_step_error\": true,\n \"delay\": {\n \"conditions_apply_over_delay\": false,\n \"for_seconds\": 60\n },\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 \"folder\": \"My folder 01\",\n \"form_fields\": [\n {\n \"array\": true,\n \"description\": \"The customer affected by this incident\",\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"key\": \"affected_customer\",\n \"required\": true,\n \"title\": \"Affected customer\",\n \"type\": \"User\"\n }\n ],\n \"include_private_escalations\": true,\n \"include_private_incidents\": true,\n \"name\": \"My little workflow\",\n \"once_for\": [\n \"incident.url\"\n ],\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"owning_teams\",\n \"runs_on_incident_modes\": [\n \"standard\",\n \"test\",\n \"retrospective\"\n ],\n \"runs_on_incidents\": \"newly_created\",\n \"shortform\": \"page-the-ceo\",\n \"skip_step_upgrades\": false,\n \"state\": \"active\",\n \"steps\": [\n {\n \"for_each\": \"abc123\",\n \"id\": \"abc123\",\n \"name\": \"pagerduty.escalate\",\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 }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/workflows/{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 \"annotations\": {\n \"incident.io/terraform/version\": \"3.0.0\"\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 \"continue_on_step_error\": true,\n \"delay\": {\n \"conditions_apply_over_delay\": false,\n \"for_seconds\": 60\n },\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 \"folder\": \"My folder 01\",\n \"form_fields\": [\n {\n \"array\": true,\n \"description\": \"The customer affected by this incident\",\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"key\": \"affected_customer\",\n \"required\": true,\n \"title\": \"Affected customer\",\n \"type\": \"User\"\n }\n ],\n \"include_private_escalations\": true,\n \"include_private_incidents\": true,\n \"name\": \"My little workflow\",\n \"once_for\": [\n \"incident.url\"\n ],\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"owning_teams\",\n \"runs_on_incident_modes\": [\n \"standard\",\n \"test\",\n \"retrospective\"\n ],\n \"runs_on_incidents\": \"newly_created\",\n \"shortform\": \"page-the-ceo\",\n \"skip_step_upgrades\": false,\n \"state\": \"active\",\n \"steps\": [\n {\n \"for_each\": \"abc123\",\n \"id\": \"abc123\",\n \"name\": \"pagerduty.escalate\",\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 }\n ]\n}"
response = http.request(request)
puts response.read_body{
"management_meta": {
"annotations": {
"incident.io/terraform/version": "3.0.0"
},
"managed_by": "dashboard",
"source_url": "https://github.com/my-company/infrastructure"
},
"workflow": {
"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"
}
}
]
}
],
"continue_on_step_error": true,
"delay": {
"conditions_apply_over_delay": false,
"for_seconds": 60
},
"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"
}
},
"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"
}
],
"folder": "My folder 01",
"form_fields": [
{
"array": true,
"description": "The customer affected by this incident",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"key": "affected_customer",
"required": true,
"title": "Affected customer",
"type": "User"
}
],
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"include_private_escalations": true,
"include_private_incidents": true,
"name": "My little workflow",
"once_for": [
{
"array": false,
"key": "incident.custom_field[\"01FCNDV6P870EA6S7TK1DSYDG0\"]",
"label": "Incident -> Affected Team",
"type": "IncidentSeverity"
}
],
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"private_incident_scope": "owning_teams",
"runs_from": "2021-08-17T13:28:57.801578Z",
"runs_on_incident_modes": [
"standard",
"test",
"retrospective"
],
"runs_on_incidents": "newly_created",
"shortform": "page-the-ceo",
"state": "active",
"steps": [
{
"for_each": "abc123",
"id": "abc123",
"label": "PagerDuty Escalate",
"name": "pagerduty.escalate",
"param_bindings": [
{
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
]
}
],
"trigger": {
"label": "Incident Updated",
"name": "incident.updated"
},
"version": 3
}
}Authorizations
API key from your incident.io dashboard (Settings → API keys)
Path Parameters
ID of the workflow to update
"01FCNDV6P870EA6S7TK1DSYDG0"
Body
Conditions that apply to the workflow trigger
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"
}
]
}
]
Whether to continue executing the workflow if a step fails
true
The expressions to use in the workflow
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"
}
]
Name provided by the user when creating the workflow
"My little workflow"
This workflow will run 'once for' a list of references
["incident.url"]
Which incident modes should this workflow run on? By default, workflows only run on standard incidents, but can also be configured to run on test and retrospective incidents.
standard, test, retrospective ["standard", "test", "retrospective"]
Which incidents should the workflow be applied to?
newly_created, newly_created_and_active "newly_created"
Steps that are executed as part of the workflow
Show child attributes
Show child attributes
[
{
"for_each": "abc123",
"id": "abc123",
"name": "pagerduty.escalate",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
]
}
]
Annotations that track metadata about this resource
Show child attributes
Show child attributes
{ "incident.io/terraform/version": "3.0.0" }
Show child attributes
Show child attributes
{
"conditions_apply_over_delay": false,
"for_seconds": 60
}
Folder to display the workflow in
"My folder 01"
User-configured form fields available in the workflow scope (manual triggers only)
Show child attributes
Show child attributes
[
{
"array": true,
"description": "The customer affected by this incident",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"key": "affected_customer",
"required": true,
"title": "Affected customer",
"type": "User"
}
]
Whether to include private escalations
true
DEPRECATED: use private_incident_scope instead. May be sent alongside private_incident_scope only if they agree; contradictory values return a validation error.
true
IDs of the teams that own this workflow
["01G0J1EXE7AXZ2C93K61WBPYEH"]
Which private incidents this workflow acts on: every private incident (all), those an owning team can see (owning_teams), or none
all, owning_teams, none "owning_teams"
The shortform used to trigger this workflow (only applicable for manual triggers)
"page-the-ceo"
Skips workflow step upgrades, when the parameters for an existing workflow step change
false
What state this workflow is in
active, disabled, draft, error "active"
Was this page helpful?
curl --request PUT \
--url https://api.incident.io/v2/workflows/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"annotations": {
"incident.io/terraform/version": "3.0.0"
},
"condition_groups": [
{
"conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
]
}
],
"continue_on_step_error": true,
"delay": {
"conditions_apply_over_delay": false,
"for_seconds": 60
},
"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"
}
],
"folder": "My folder 01",
"form_fields": [
{
"array": true,
"description": "The customer affected by this incident",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"key": "affected_customer",
"required": true,
"title": "Affected customer",
"type": "User"
}
],
"include_private_escalations": true,
"include_private_incidents": true,
"name": "My little workflow",
"once_for": [
"incident.url"
],
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"private_incident_scope": "owning_teams",
"runs_on_incident_modes": [
"standard",
"test",
"retrospective"
],
"runs_on_incidents": "newly_created",
"shortform": "page-the-ceo",
"skip_step_upgrades": false,
"state": "active",
"steps": [
{
"for_each": "abc123",
"id": "abc123",
"name": "pagerduty.escalate",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
]
}
]
}
'import requests
url = "https://api.incident.io/v2/workflows/{id}"
payload = {
"annotations": { "incident.io/terraform/version": "3.0.0" },
"condition_groups": [{ "conditions": [
{
"operation": "one_of",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
],
"subject": "incident.severity"
}
] }],
"continue_on_step_error": True,
"delay": {
"conditions_apply_over_delay": False,
"for_seconds": 60
},
"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"
}
],
"folder": "My folder 01",
"form_fields": [
{
"array": True,
"description": "The customer affected by this incident",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"key": "affected_customer",
"required": True,
"title": "Affected customer",
"type": "User"
}
],
"include_private_escalations": True,
"include_private_incidents": True,
"name": "My little workflow",
"once_for": ["incident.url"],
"owning_team_ids": ["01G0J1EXE7AXZ2C93K61WBPYEH"],
"private_incident_scope": "owning_teams",
"runs_on_incident_modes": ["standard", "test", "retrospective"],
"runs_on_incidents": "newly_created",
"shortform": "page-the-ceo",
"skip_step_upgrades": False,
"state": "active",
"steps": [
{
"for_each": "abc123",
"id": "abc123",
"name": "pagerduty.escalate",
"param_bindings": [
{
"array_value": [
{
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"literal": "SEV123",
"reference": "incident.severity"
}
}
]
}
]
}
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({
annotations: {'incident.io/terraform/version': '3.0.0'},
condition_groups: [
{
conditions: [
{
operation: 'one_of',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
],
subject: 'incident.severity'
}
]
}
],
continue_on_step_error: true,
delay: {conditions_apply_over_delay: false, for_seconds: 60},
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'
}
],
folder: 'My folder 01',
form_fields: [
{
array: true,
description: 'The customer affected by this incident',
id: '01FCNDV6P870EA6S7TK1DSYDG0',
key: 'affected_customer',
required: true,
title: 'Affected customer',
type: 'User'
}
],
include_private_escalations: true,
include_private_incidents: true,
name: 'My little workflow',
once_for: ['incident.url'],
owning_team_ids: ['01G0J1EXE7AXZ2C93K61WBPYEH'],
private_incident_scope: 'owning_teams',
runs_on_incident_modes: ['standard', 'test', 'retrospective'],
runs_on_incidents: 'newly_created',
shortform: 'page-the-ceo',
skip_step_upgrades: false,
state: 'active',
steps: [
{
for_each: 'abc123',
id: 'abc123',
name: 'pagerduty.escalate',
param_bindings: [
{
array_value: [{literal: 'SEV123', reference: 'incident.severity'}],
value: {literal: 'SEV123', reference: 'incident.severity'}
}
]
}
]
})
};
fetch('https://api.incident.io/v2/workflows/{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/v2/workflows/{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([
'annotations' => [
'incident.io/terraform/version' => '3.0.0'
],
'condition_groups' => [
[
'conditions' => [
[
'operation' => 'one_of',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
],
'subject' => 'incident.severity'
]
]
]
],
'continue_on_step_error' => true,
'delay' => [
'conditions_apply_over_delay' => false,
'for_seconds' => 60
],
'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'
]
],
'folder' => 'My folder 01',
'form_fields' => [
[
'array' => true,
'description' => 'The customer affected by this incident',
'id' => '01FCNDV6P870EA6S7TK1DSYDG0',
'key' => 'affected_customer',
'required' => true,
'title' => 'Affected customer',
'type' => 'User'
]
],
'include_private_escalations' => true,
'include_private_incidents' => true,
'name' => 'My little workflow',
'once_for' => [
'incident.url'
],
'owning_team_ids' => [
'01G0J1EXE7AXZ2C93K61WBPYEH'
],
'private_incident_scope' => 'owning_teams',
'runs_on_incident_modes' => [
'standard',
'test',
'retrospective'
],
'runs_on_incidents' => 'newly_created',
'shortform' => 'page-the-ceo',
'skip_step_upgrades' => false,
'state' => 'active',
'steps' => [
[
'for_each' => 'abc123',
'id' => 'abc123',
'name' => 'pagerduty.escalate',
'param_bindings' => [
[
'array_value' => [
[
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
],
'value' => [
'literal' => 'SEV123',
'reference' => 'incident.severity'
]
]
]
]
]
]),
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/workflows/{id}"
payload := strings.NewReader("{\n \"annotations\": {\n \"incident.io/terraform/version\": \"3.0.0\"\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 \"continue_on_step_error\": true,\n \"delay\": {\n \"conditions_apply_over_delay\": false,\n \"for_seconds\": 60\n },\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 \"folder\": \"My folder 01\",\n \"form_fields\": [\n {\n \"array\": true,\n \"description\": \"The customer affected by this incident\",\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"key\": \"affected_customer\",\n \"required\": true,\n \"title\": \"Affected customer\",\n \"type\": \"User\"\n }\n ],\n \"include_private_escalations\": true,\n \"include_private_incidents\": true,\n \"name\": \"My little workflow\",\n \"once_for\": [\n \"incident.url\"\n ],\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"owning_teams\",\n \"runs_on_incident_modes\": [\n \"standard\",\n \"test\",\n \"retrospective\"\n ],\n \"runs_on_incidents\": \"newly_created\",\n \"shortform\": \"page-the-ceo\",\n \"skip_step_upgrades\": false,\n \"state\": \"active\",\n \"steps\": [\n {\n \"for_each\": \"abc123\",\n \"id\": \"abc123\",\n \"name\": \"pagerduty.escalate\",\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 }\n ]\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/v2/workflows/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"annotations\": {\n \"incident.io/terraform/version\": \"3.0.0\"\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 \"continue_on_step_error\": true,\n \"delay\": {\n \"conditions_apply_over_delay\": false,\n \"for_seconds\": 60\n },\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 \"folder\": \"My folder 01\",\n \"form_fields\": [\n {\n \"array\": true,\n \"description\": \"The customer affected by this incident\",\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"key\": \"affected_customer\",\n \"required\": true,\n \"title\": \"Affected customer\",\n \"type\": \"User\"\n }\n ],\n \"include_private_escalations\": true,\n \"include_private_incidents\": true,\n \"name\": \"My little workflow\",\n \"once_for\": [\n \"incident.url\"\n ],\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"owning_teams\",\n \"runs_on_incident_modes\": [\n \"standard\",\n \"test\",\n \"retrospective\"\n ],\n \"runs_on_incidents\": \"newly_created\",\n \"shortform\": \"page-the-ceo\",\n \"skip_step_upgrades\": false,\n \"state\": \"active\",\n \"steps\": [\n {\n \"for_each\": \"abc123\",\n \"id\": \"abc123\",\n \"name\": \"pagerduty.escalate\",\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 }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.incident.io/v2/workflows/{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 \"annotations\": {\n \"incident.io/terraform/version\": \"3.0.0\"\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 \"continue_on_step_error\": true,\n \"delay\": {\n \"conditions_apply_over_delay\": false,\n \"for_seconds\": 60\n },\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 \"folder\": \"My folder 01\",\n \"form_fields\": [\n {\n \"array\": true,\n \"description\": \"The customer affected by this incident\",\n \"id\": \"01FCNDV6P870EA6S7TK1DSYDG0\",\n \"key\": \"affected_customer\",\n \"required\": true,\n \"title\": \"Affected customer\",\n \"type\": \"User\"\n }\n ],\n \"include_private_escalations\": true,\n \"include_private_incidents\": true,\n \"name\": \"My little workflow\",\n \"once_for\": [\n \"incident.url\"\n ],\n \"owning_team_ids\": [\n \"01G0J1EXE7AXZ2C93K61WBPYEH\"\n ],\n \"private_incident_scope\": \"owning_teams\",\n \"runs_on_incident_modes\": [\n \"standard\",\n \"test\",\n \"retrospective\"\n ],\n \"runs_on_incidents\": \"newly_created\",\n \"shortform\": \"page-the-ceo\",\n \"skip_step_upgrades\": false,\n \"state\": \"active\",\n \"steps\": [\n {\n \"for_each\": \"abc123\",\n \"id\": \"abc123\",\n \"name\": \"pagerduty.escalate\",\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 }\n ]\n}"
response = http.request(request)
puts response.read_body{
"management_meta": {
"annotations": {
"incident.io/terraform/version": "3.0.0"
},
"managed_by": "dashboard",
"source_url": "https://github.com/my-company/infrastructure"
},
"workflow": {
"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"
}
}
]
}
],
"continue_on_step_error": true,
"delay": {
"conditions_apply_over_delay": false,
"for_seconds": 60
},
"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"
}
},
"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"
}
],
"folder": "My folder 01",
"form_fields": [
{
"array": true,
"description": "The customer affected by this incident",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"key": "affected_customer",
"required": true,
"title": "Affected customer",
"type": "User"
}
],
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"include_private_escalations": true,
"include_private_incidents": true,
"name": "My little workflow",
"once_for": [
{
"array": false,
"key": "incident.custom_field[\"01FCNDV6P870EA6S7TK1DSYDG0\"]",
"label": "Incident -> Affected Team",
"type": "IncidentSeverity"
}
],
"owning_team_ids": [
"01G0J1EXE7AXZ2C93K61WBPYEH"
],
"private_incident_scope": "owning_teams",
"runs_from": "2021-08-17T13:28:57.801578Z",
"runs_on_incident_modes": [
"standard",
"test",
"retrospective"
],
"runs_on_incidents": "newly_created",
"shortform": "page-the-ceo",
"state": "active",
"steps": [
{
"for_each": "abc123",
"id": "abc123",
"label": "PagerDuty Escalate",
"name": "pagerduty.escalate",
"param_bindings": [
{
"array_value": [
{
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
],
"value": {
"label": "Lawrence Jones",
"literal": "SEV123",
"reference": "incident.severity"
}
}
]
}
],
"trigger": {
"label": "Incident Updated",
"name": "incident.updated"
},
"version": 3
}
}