Chilkat Online Tools

C# / Squadcast API V3 / Reassign Incident

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Chilkat.Http http = new Chilkat.Http();
bool success;

// Use this online tool to generate code from sample JSON: Generate Code to Create JSON

// The following JSON is sent in the request body.

// {
//   "id": "5d91d262a2c85fa24a27d4da",
//   "type": "user"
// }

Chilkat.JsonObject json = new Chilkat.JsonObject();
json.UpdateString("id","5d91d262a2c85fa24a27d4da");
json.UpdateString("type","user");

// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>";

Chilkat.HttpResponse resp = http.PostJson3("https://api.squadcast.com/v3/incidents/:incidentID/reassign","application/json",json);
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Debug.WriteLine(Convert.ToString(resp.StatusCode));
Debug.WriteLine(resp.BodyStr);

Curl Command

curl -X POST
	-H "Authorization: Bearer <access_token>"
	-d '{
	"id": "5d91d262a2c85fa24a27d4da",
	"type": "user"
}'
https://api.squadcast.com/v3/incidents/:incidentID/reassign

Postman Collection Item JSON

{
  "name": "Reassign Incident",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{sq_pb_auth_header}}",
          "type": "string"
        }
      ]
    },
    "method": "POST",
    "header": [
    ],
    "body": {
      "mode": "raw",
      "raw": "{\n\t\"id\": \"5d91d262a2c85fa24a27d4da\",\n\t\"type\": \"user\"\n}",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{baseUrl}}/incidents/:incidentID/reassign",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "incidents",
        ":incidentID",
        "reassign"
      ],
      "variable": [
        {
          "key": "incidentID",
          "value": "5d81d9bc60e42f6b99ca4307"
        }
      ]
    },
    "description": "- This endpoint is used to reassign the unresolved incident to any user or escalation policy or squads by ID.\n- Requires `access_token` as a `Bearer {{token}}` in the `Authorization` header.\n- `type` can be either `user` or `escalationpolicy` or `squad`"
  },
  "response": [
    {
      "name": "200 OK",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"id\": \"5d91d262a2c85fa24a27d4da\",\n\t\"type\": \"user\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/reassign",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "reassign"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"data\": {\n        \"id\": \"5d81d9bc60e42f6b99ca4307\",\n        \"service_id\": \"5d81d9687000fb6b9def7e35\",\n        \"alert_source_id\": \"5a9002f082bb573a2bc779eb\",\n        \"organization_id\": \"5d81d9187000fb6b9def7e32\",\n        \"incidentNumber\": 3,\n        \"message\": \"[warning] CPUThrottlingHigh\",\n        \"assignedTo\": [\n            {\n                \"id\": \"5d81d9407000fb6b9def7e33\",\n                \"type\": \"escalationpolicy\",\n                \"timeOfAssignment\": \"2019-09-18T07:16:12.218Z\"\n            },\n            {\n                \"id\": \"5d81d9187000fb6b9def7e31\",\n                \"type\": \"user\",\n                \"timeOfAssignment\": \"2019-09-20T11:06:37.838Z\"\n            }\n        ],\n        \"description\": \"Message: 64% throttling of CPU in namespace kube-system for container autoscaler in pod calico-typha-horizontal-autoscaler-5ff7f558cc-qlm2t.\\nRunbook url: https://github.com/kubernetes-monitoring/kubernetes-mixin/tree/master/runbook.md#alert-name-cputhrottlinghigh\\nLabels\\n  Alertname: CPUThrottlingHigh\\n  Container name: autoscaler\\n  Namespace: kube-system\\n  Pod name: calico-typha-horizontal-autoscaler-5ff7f558cc-qlm2t\\n  Prometheus: monitoring/monitoring-prometheus-oper-prometheus\\n  Severity: warning\\n  Generator URL: http://monitoring-prometheus-oper-prometheus.monitoring:9090/graph?g0.expr=100+%2A+sum+by%28container_name%2C+pod_name%2C+namespace%29+%28increase%28container_cpu_cfs_throttled_periods_total%7Bcontainer_name%21%3D%22%22%7D%5B5m%5D%29%29+%2F+sum+by%28container_name%2C+pod_name%2C+namespace%29+%28increase%28container_cpu_cfs_periods_total%5B5m%5D%29%29+%3E+25&g0.tab=1\",\n        \"status\": \"resolved\",\n        \"timeOfCreation\": \"2019-09-18T07:16:12.218Z\",\n        \"tags\": null,\n        \"logs\": [\n            {\n                \"action\": \"triggered\",\n                \"assignedTo\": \"escalationpolicy\",\n                \"id\": \"5d81d9407000fb6b9def7e33\",\n                \"time\": \"2019-09-18T07:16:12.215Z\",\n                \"reason\": \"\",\n                \"additionalInfo\": null\n            },\n            {\n                \"action\": \"acknowledged\",\n                \"assignedTo\": \"user\",\n                \"id\": \"5d81d9187000fb6b9def7e31\",\n                \"time\": \"2019-09-20T11:06:37.838Z\",\n                \"reason\": \"\",\n                \"additionalInfo\": null\n            },\n            {\n                \"action\": \"resolved\",\n                \"assignedTo\": \"user\",\n                \"id\": \"5d81d9187000fb6b9def7e31\",\n                \"time\": \"2019-09-20T11:06:40.724Z\",\n                \"reason\": \"\",\n                \"additionalInfo\": null\n            }\n        ],\n        \"analytics\": {\n            \"tta\": {\n                \"time\": 186625623,\n                \"userId\": \"5d81d9187000fb6b9def7e31\",\n                \"escalationPolicyId\": \"5d81d9407000fb6b9def7e33\",\n                \"squadId\": \"000000000000000000000000\"\n            },\n            \"ttr\": {\n                \"time\": 186628509,\n                \"userId\": \"5d81d9187000fb6b9def7e31\",\n                \"escalationPolicyId\": \"5d81d9407000fb6b9def7e33\",\n                \"squadId\": \"000000000000000000000000\"\n            }\n        },\n        \"pinned_messages\": null,\n        \"deleted\": false,\n        \"relevantUsers\": [],\n        \"relevantEscalationPolicies\": [],\n        \"relevantSquads\": [],\n        \"relevantSchedules\": [],\n        \"relevantPeopleLogs\": [],\n        \"responseNotes\": []\n    }\n}"
    },
    {
      "name": "400 Bad Request",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"id\": \"5d81d9bc60e42f6b99ca4305\",\n\t\"type\": \"\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/reassign",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "reassign"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 400,\n        \"error_message\": \"reassign to type required\"\n    }\n}"
    },
    {
      "name": "400 Bad Request",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"id\": \"5d81d9bc60e42f6b99ca4305\",\n\t\"type\": \"usear\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/reassign",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "reassign"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 400,\n        \"error_message\": \"reassign to type usear is invalid\"\n    }\n}"
    },
    {
      "name": "400 Bad Request",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"id\": \"5d91d262a2c85fa24a27d4da\",\n\t\"type\": \"user\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/reassign",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "reassign"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 400,\n        \"error_message\": \"you can't reassign to same user\"\n    }\n}"
    },
    {
      "name": "400 Bad Request",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"id\": \"5d91d262a2c85fa24a27d4da\",\n\t\"type\": \"user\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/reassign",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "reassign"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 400,\n        \"error_message\": \"incident has already been resolved\"\n    }\n}"
    },
    {
      "name": "400 Bad Request",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"id\": \"5d81d9bc60e42f6b99ca4305\",\n\t\"type\": \"user\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/reassign",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "reassign"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 400,\n        \"error_message\": \"invalid user id\"\n    }\n}"
    },
    {
      "name": "401 Unauthorized",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"id\": \"5d91d262a2c85fa24a27d4da\",\n\t\"type\": \"user\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/reassign",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "reassign"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Unauthorized",
      "code": 401,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 401,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "403 Forbidden",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"id\": \"5d91d262a2c85fa24a27d4da\",\n\t\"type\": \"user\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/reassign",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "reassign"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 403,\n        \"error_message\": \"<string>\"\n    }\n}"
    },
    {
      "name": "500 Internal Server Error",
      "originalRequest": {
        "method": "POST",
        "header": [
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"id\": \"5d91d262a2c85fa24a27d4da\",\n\t\"type\": \"user\"\n}",
          "options": {
            "raw": {
              "language": "json"
            }
          }
        },
        "url": {
          "raw": "{{baseUrl}}/incidents/:incidentID/reassign",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "incidents",
            ":incidentID",
            "reassign"
          ],
          "variable": [
            {
              "key": "incidentID",
              "value": "5d81d9bc60e42f6b99ca4307"
            }
          ]
        }
      },
      "status": "Internal Server Error",
      "code": 500,
      "_postman_previewlanguage": "json",
      "header": null,
      "cookie": [
      ],
      "body": "{\n    \"meta\": {\n        \"status\": 500,\n        \"error_message\": \"<string>\"\n    }\n}"
    }
  ]
}