IncidentIo.IncidentsV2 (IncidentIo v0.1.1)

View Source

Create and read incidents.

Incidents are a core resource, on which many other resources (actions, etc) are created.

Care should be taken around these endpoints, as automation that creates duplicate incidents can be distracting, and impact reporting.

Summary

Functions

Create a new incident.

List all incidents for an organisation.

Get a single incident.

Update an existing incident.

Functions

create(client \\ %Client{}, body)

@spec create(IncidentIo.Client.t(), create_request_body()) :: IncidentIo.response()

Create a new incident.

Incident body example:

%{
  custom_field_entries: [
    %{
      custom_field_id: "01FCNDV6P870EA6S7TK1DSYDG0",
      values: [
        %{
          id: "01FCNDV6P870EA6S7TK1DSYDG0",
          value_catalog_entry_id: "01FCNDV6P870EA6S7TK1DSYDG0",
          value_link: "https://google.com/",
          value_numeric: "123.456",
          value_option_id: "01FCNDV6P870EA6S7TK1DSYDG0",
          value_text: "This is my text field, I hope you like it",
          value_timestamp: ""
        }
      ]
    }
  ],
  id: "01FDAG4SAP5TYPT98WGR2N7W91",
  idempotency_key: "alert-uuid",
  incident_role_assignments: [
    %{
      assignee: %{
        email: "bob@example.com",
        id: "01G0J1EXE7AXZ2C93K61WBPYEH",
        slack_user_id: "USER123"
      },
      incident_role_id: "01FH5TZRWMNAFB0DZ23FD1TV96"
    }
  ],
  incident_status_id: "01G0J1EXE7AXZ2C93K61WBPYEH",
  incident_timestamp_values: [
    %{
      incident_timestamp_id: "01FCNDV6P870EA6S7TK1DSYD5H",
      value: "2021-08-17T13:28:57.801578Z"
    }
  ],
  incident_type_id: "01FH5TZRWMNAFB0DZ23FD1TV96",
  mode: "standard",
  name: "Our database is sad",
  retrospective_incident_options: %{
    postmortem_document_url: "https://docs.google.com/my_doc_id",
    slack_channel_id: "abc123"
  },
  severity_id: "01FH5TZRWMNAFB0DZ23FD1TV96",
  slack_channel_name_override: "inc-123-database-down",
  slack_team_id: "T02A1FSLE8J",
  summary: "Our database is really really sad, and we don't know why yet.",
  visibility: "public"
}

Example

IncidentIo.IncidentsV2.create(client, body)

More information at: https://api-docs.incident.io/tag/Incidents-V2#operation/Incidents%20V2_Create

list(client \\ %Client{}, opts \\ [])

@spec list(IncidentIo.Client.t(), request_options()) :: IncidentIo.response()

List all incidents for an organisation.

Example

IncidentIo.IncidentsV2.list(client)

More information at: https://api-docs.incident.io/tag/Incidents-V2#operation/Incidents%20V2_List

show(client \\ %Client{}, id)

Get a single incident.

Example

IncidentIo.IncidentsV2.show(client, "some-incident-id")

More information at: https://api-docs.incident.io/tag/Incidents-V2#operation/Incidents%20V2_Show

update(client \\ %Client{}, id, body)

@spec update(IncidentIo.Client.t(), binary(), update_request_body()) ::
  IncidentIo.response()

Update an existing incident.

Incident body example:

%{
  incident: %{
    call_url: "https://zoom.us/foo",
    custom_field_entries: [
      %{
        custom_field_id: "01FCNDV6P870EA6S7TK1DSYDG0",
        values: [
          %{
            id: "01FCNDV6P870EA6S7TK1DSYDG0",
            value_catalog_entry_id: "01FCNDV6P870EA6S7TK1DSYDG0",
            value_link: "https://google.com/",
            value_numeric: "123.456",
            value_option_id: "01FCNDV6P870EA6S7TK1DSYDG0",
            value_text: "This is my text field, I hope you like it",
            value_timestamp: ""
          }
        ]
      }
    ],
    incident_role_assignments: [
      %{
        assignee: %{
          email: "bob@example.com",
          id: "01G0J1EXE7AXZ2C93K61WBPYEH",
          slack_user_id: "USER123"
        },
        incident_role_id: "01FH5TZRWMNAFB0DZ23FD1TV96"
      }
    ],
    incident_status_id: "01FH5TZRWMNAFB0DZ23FD1TV96",
    incident_timestamp_values: [
      %{
        incident_timestamp_id: "01FCNDV6P870EA6S7TK1DSYD5H",
        value: "2021-08-17T13:28:57.801578Z"
      }
    ],
    name: "Our database is sad",
    severity_id: "01FH5TZRWMNAFB0DZ23FD1TV96",
    summary: "Our database is really really sad, and we don't know why yet."
  },
  notify_incident_channel: true
}

Example

IncidentIo.IncidentsV2.update(client, "some-incident-id", body)

More information at: https://api-docs.incident.io/tag/Incidents-V2#operation/Incidents%20V2_Update