Incidents

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

POST https://api.datadoghq.eu/api/v2/incidentshttps://api.ddog-gov.com/api/v2/incidentshttps://api.datadoghq.com/api/v2/incidentshttps://api.us3.datadoghq.com/api/v2/incidents

Présentation

Create an incident.

Requête

Body Data (required)

Incident payload.

Expand All

Champ

Type

Description

data [required]

object

Incident data for a create request.

attributes [required]

object

The incident's attributes for a create request.

customer_impacted [required]

boolean

A flag indicating whether the incident caused customer impact.

fields

object

A condensed view of the user-defined fields for which to create initial selections.

<any-key>

object <oneOf>

Dynamic fields for which selections can be made, with field names as keys.

Option 1

object

A field with a single value selected.

type

enum

Type of the single value field definitions. Allowed enum values: dropdown,textbox

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

Type of the single value field definitions. Allowed enum values: multiselect,textarray,metrictag,autocomplete

value

[string]

The multiple values selected for this field.

initial_timeline_cells

[object <oneOf>]

An array of initial timeline cells to be placed at the beginning of the incident timeline.

Option 1

object

Timeline cell data for Markdown timeline cells for a create request.

cell_type [required]

enum

Type of the Markdown timeline cell. Allowed enum values: markdown

content [required]

object

The Markdown timeline cell contents.

content [required]

string

The Markdown content of the cell.

important

boolean

A flag indicating whether the timeline cell is important and should be highlighted.

notification_handles

[string]

Notification handles that will be notified of the incident at creation.

title [required]

string

The title of the incident, which summarizes what happened.

relationships

object

The relationships the incident will have with other resources once created.

commander [required]

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

type [required]

enum

Incident resource type. Allowed enum values: incidents

{
  "data": {
    "attributes": {
      "customer_impacted": false,
      "fields": {
        "<any-key>": {}
      },
      "initial_timeline_cells": [
        {
          "cell_type": "markdown",
          "content": {
            "content": "An example timeline cell message."
          },
          "important": false
        }
      ],
      "notification_handles": [
        "@test.user@test.com"
      ],
      "title": "A test incident title"
    },
    "relationships": {
      "commander": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      }
    },
    "type": "incidents"
  }
}

Réponse

CREATED

Response with an incident.

Expand All

Champ

Type

Description

data [required]

object

Incident data from a response.

attributes

object

The incident's attributes from a response.

created

date-time

Timestamp when the incident was created.

customer_impact_duration

int64

Length of the incident's customer impact in seconds. Equals the difference between customer_impact_start and customer_impact_end.

customer_impact_end

date-time

Timestamp when customers were no longer impacted by the incident.

customer_impact_scope

string

A summary of the impact customers experienced during the incident.

customer_impact_start

date-time

Timestamp when customers began being impacted by the incident.

customer_impacted

boolean

A flag indicating whether the incident caused customer impact.

detected

date-time

Timestamp when the incident was detected.

fields

object

A condensed view of the user-defined fields attached to incidents.

<any-key>

object <oneOf>

Dynamic fields for which selections can be made, with field names as keys.

Option 1

object

A field with a single value selected.

type

enum

Type of the single value field definitions. Allowed enum values: dropdown,textbox

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

Type of the single value field definitions. Allowed enum values: multiselect,textarray,metrictag,autocomplete

value

[string]

The multiple values selected for this field.

modified

date-time

Timestamp when the incident was last modified.

notification_handles

[string]

Notification handles that will be notified of the incident during update.

postmortem_id

string

The UUID of the postmortem object attached to the incident.

public_id

int64

The monotonically increasing integer ID for the incident.

resolved

date-time

Timestamp when the incident's state was set to resolved.

time_to_detect

int64

The amount of time in seconds to detect the incident. Equals the difference between customer_impact_start and detected.

time_to_internal_response

int64

The amount of time in seconds to call incident after detection. Equals the difference of detected and created.

time_to_repair

int64

The amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between customer_impact_end and detected.

time_to_resolve

int64

The amount of time in seconds to resolve the incident after it was created. Equals the difference between created and resolved.

title [required]

string

The title of the incident, which summarizes what happened.

id [required]

string

The incident's ID.

relationships

object

The incident's relationships from a response.

commander_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

created_by_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

The integration metadata relationship array

id [required]

string

A unique identifier that represents the integration metadata.

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integration_metadata

last_modified_by_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

postmortem

object

A relationship reference for postmortems.

data [required]

object

The postmortem relationship data.

id [required]

string

A unique identifier that represents the postmortem.

type [required]

enum

Incident postmortem resource type. Allowed enum values: incident_postmortems

type [required]

enum

Incident resource type. Allowed enum values: incidents

included

[object <oneOf>]

Included related resources that the user requested.

Option 1

object

User object returned by the API.

attributes

object

Attributes of user object returned by the API.

created_at

date-time

Creation time of the user.

disabled

boolean

Whether the user is disabled.

email

string

Email of the user.

handle

string

Handle of the user.

icon

string

URL of the user's icon.

modified_at

date-time

Time that the user was last modified.

name

string

Name of the user.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id [required]

string

ID of the user.

relationships

object

Relationships of the user object returned by the API.

org

object

Relationship to an organization.

data [required]

object

Relationship to organization object.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

other_orgs

object

Relationship to organizations.

data [required]

[object]

Relationships to organization objects.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

other_users

object

Relationship to users.

data [required]

[object]

Relationships to user objects.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

roles

object

Relationship to roles.

data [required]

[object]

An array containing type and ID of a role.

id

string

ID of the role.

type

enum

Roles type. Allowed enum values: roles

type [required]

enum

Users resource type. Allowed enum values: users

{
  "data": {
    "attributes": {
      "created": "2019-09-19T10:00:00.000Z",
      "customer_impact_duration": "integer",
      "customer_impact_end": "2019-09-19T10:00:00.000Z",
      "customer_impact_scope": "An example customer impact scope",
      "customer_impact_start": "2019-09-19T10:00:00.000Z",
      "customer_impacted": false,
      "detected": "2019-09-19T10:00:00.000Z",
      "fields": {
        "<any-key>": {}
      },
      "modified": "2019-09-19T10:00:00.000Z",
      "notification_handles": [
        "@test.user@test.com"
      ],
      "postmortem_id": "00000000-0000-0000-0000-000000000000",
      "public_id": 1,
      "resolved": "2019-09-19T10:00:00.000Z",
      "time_to_detect": "integer",
      "time_to_internal_response": "integer",
      "time_to_repair": "integer",
      "time_to_resolve": "integer",
      "title": "A test incident title"
    },
    "id": "00000000-0000-0000-0000-000000000000",
    "relationships": {
      "commander_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "integrations": {
        "data": [
          {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "incident_integration_metadata"
          }
        ]
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "postmortem": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "incident_postmortems"
        }
      }
    },
    "type": "incidents"
  },
  "included": [
    {
      "attributes": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "disabled": false,
        "email": "string",
        "handle": "string",
        "icon": "string",
        "modified_at": "2019-09-19T10:00:00.000Z",
        "name": "string",
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Unauthorized

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/incidents" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "customer_impacted": false,
      "title": "A test incident title"
    },
    "relationships": {
      "commander": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      }
    },
    "type": "incidents"
  }
}
EOF
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    body := *datadog.NewIncidentCreateRequest(*datadog.NewIncidentCreateData(*datadog.NewIncidentCreateAttributes(false, "A test incident title"), datadog.IncidentType("incidents"))) // IncidentCreateRequest | Incident payload.

    configuration := datadog.NewConfiguration()
    configuration.SetUnstableOperationEnabled("CreateIncident", true)

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.IncidentsApi.CreateIncident(ctx).Body(body).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.CreateIncident``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateIncident`: IncidentResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from IncidentsApi.CreateIncident:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.IncidentsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        IncidentsApi apiInstance = new IncidentsApi(defaultClient);
        IncidentCreateRequest body = new IncidentCreateRequest(); // IncidentCreateRequest | Incident payload.
        try {
            IncidentResponse result = apiInstance.createIncident(body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling IncidentsApi#createIncident");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import incidents_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
configuration.unstable_operations["create_incident"] = True

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = incidents_api.IncidentsApi(api_client)
    body = IncidentCreateRequest(
        data=IncidentCreateData(
            attributes=IncidentCreateAttributes(
                customer_impacted=False,
                fields={
                    "key": IncidentFieldAttributes(),
                },
                initial_timeline_cells=[
                    IncidentTimelineCellCreateAttributes(),
                ],
                notification_handles=[
                    "@test.user@test.com",
                ],
                title="A test incident title",
            ),
            relationships=IncidentCreateRelationships(
                commander=RelationshipToUser(
                    data=RelationshipToUserData(
                        id="00000000-0000-0000-0000-000000000000",
                        type=UsersType("users"),
                    ),
                ),
            ),
            type=IncidentType("incidents"),
        ),
    )  # IncidentCreateRequest | Incident payload.

    # example passing only required values which don't have defaults set
    try:
        # Create an incident
        api_response = api_instance.create_incident(body)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling IncidentsApi->create_incident: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'

DatadogAPIClient::V2.configure do |config|
  config.unstable_operations[:create_incident] = true
end

api_instance = DatadogAPIClient::V2::IncidentsAPI.new
body = DatadogAPIClient::V2::IncidentCreateRequest.new({data: DatadogAPIClient::V2::IncidentCreateData.new({attributes: DatadogAPIClient::V2::IncidentCreateAttributes.new({customer_impacted: false, title: 'A test incident title'}), type: DatadogAPIClient::V2::IncidentType::INCIDENTS})}) # IncidentCreateRequest | Incident payload.

begin
  # Create an incident
  result = api_instance.create_incident(body)
  p result
rescue DatadogAPIClient::V2::APIError => e
  puts "Error when calling IncidentsAPI->create_incident: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

DELETE https://api.datadoghq.eu/api/v2/incidents/{incident_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}

Présentation

Deletes an existing incident from the users organization.

Arguments

Paramètres du chemin

Nom

Type

Description

incident_id [required]

string

The UUID the incident.

Réponse

OK

Bad Request

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Unauthorized

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Path parameters
export incident_id="CHANGE_ME"
# Curl command curl -X DELETE "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/incidents/${incident_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main

import (
    "context"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    incidentId := "incidentId_example" // string | The UUID the incident.

    configuration := datadog.NewConfiguration()
    configuration.SetUnstableOperationEnabled("DeleteIncident", true)

    apiClient := datadog.NewAPIClient(configuration)
    r, err := apiClient.IncidentsApi.DeleteIncident(ctx, incidentId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.DeleteIncident``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.IncidentsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        IncidentsApi apiInstance = new IncidentsApi(defaultClient);
        String incidentId = "incidentId_example"; // String | The UUID the incident.
        try {
            apiInstance.deleteIncident(incidentId);
        } catch (ApiException e) {
            System.err.println("Exception when calling IncidentsApi#deleteIncident");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import incidents_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
configuration.unstable_operations["delete_incident"] = True

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = incidents_api.IncidentsApi(api_client)
    incident_id = "incident_id_example"  # str | The UUID the incident.

    # example passing only required values which don't have defaults set
    try:
        # Delete an existing incident
        api_instance.delete_incident(incident_id)
    except ApiException as e:
        print("Exception when calling IncidentsApi->delete_incident: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'

DatadogAPIClient::V2.configure do |config|
  config.unstable_operations[:delete_incident] = true
end

api_instance = DatadogAPIClient::V2::IncidentsAPI.new
incident_id = 'incident_id_example' # String | The UUID the incident.

begin
  # Delete an existing incident
  api_instance.delete_incident(incident_id)
rescue DatadogAPIClient::V2::APIError => e
  puts "Error when calling IncidentsAPI->delete_incident: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

GET https://api.datadoghq.eu/api/v2/incidentshttps://api.ddog-gov.com/api/v2/incidentshttps://api.datadoghq.com/api/v2/incidentshttps://api.us3.datadoghq.com/api/v2/incidents

Présentation

Get all incidents for the user’s organization.

Arguments

Chaînes de requête

Nom

Type

Description

include

array

Specifies which types of related objects should be included in the response.

page[size]

integer

Size for a given page.

page[offset]

integer

Specific offset to use as the beginning of the returned page.

Réponse

OK

Response with a list of incidents.

Expand All

Champ

Type

Description

data [required]

[object]

An array of incidents.

attributes

object

The incident's attributes from a response.

created

date-time

Timestamp when the incident was created.

customer_impact_duration

int64

Length of the incident's customer impact in seconds. Equals the difference between customer_impact_start and customer_impact_end.

customer_impact_end

date-time

Timestamp when customers were no longer impacted by the incident.

customer_impact_scope

string

A summary of the impact customers experienced during the incident.

customer_impact_start

date-time

Timestamp when customers began being impacted by the incident.

customer_impacted

boolean

A flag indicating whether the incident caused customer impact.

detected

date-time

Timestamp when the incident was detected.

fields

object

A condensed view of the user-defined fields attached to incidents.

<any-key>

object <oneOf>

Dynamic fields for which selections can be made, with field names as keys.

Option 1

object

A field with a single value selected.

type

enum

Type of the single value field definitions. Allowed enum values: dropdown,textbox

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

Type of the single value field definitions. Allowed enum values: multiselect,textarray,metrictag,autocomplete

value

[string]

The multiple values selected for this field.

modified

date-time

Timestamp when the incident was last modified.

notification_handles

[string]

Notification handles that will be notified of the incident during update.

postmortem_id

string

The UUID of the postmortem object attached to the incident.

public_id

int64

The monotonically increasing integer ID for the incident.

resolved

date-time

Timestamp when the incident's state was set to resolved.

time_to_detect

int64

The amount of time in seconds to detect the incident. Equals the difference between customer_impact_start and detected.

time_to_internal_response

int64

The amount of time in seconds to call incident after detection. Equals the difference of detected and created.

time_to_repair

int64

The amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between customer_impact_end and detected.

time_to_resolve

int64

The amount of time in seconds to resolve the incident after it was created. Equals the difference between created and resolved.

title [required]

string

The title of the incident, which summarizes what happened.

id [required]

string

The incident's ID.

relationships

object

The incident's relationships from a response.

commander_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

created_by_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

The integration metadata relationship array

id [required]

string

A unique identifier that represents the integration metadata.

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integration_metadata

last_modified_by_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

postmortem

object

A relationship reference for postmortems.

data [required]

object

The postmortem relationship data.

id [required]

string

A unique identifier that represents the postmortem.

type [required]

enum

Incident postmortem resource type. Allowed enum values: incident_postmortems

type [required]

enum

Incident resource type. Allowed enum values: incidents

included

[object <oneOf>]

Included related resources that the user requested.

Option 1

object

User object returned by the API.

attributes

object

Attributes of user object returned by the API.

created_at

date-time

Creation time of the user.

disabled

boolean

Whether the user is disabled.

email

string

Email of the user.

handle

string

Handle of the user.

icon

string

URL of the user's icon.

modified_at

date-time

Time that the user was last modified.

name

string

Name of the user.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id [required]

string

ID of the user.

relationships

object

Relationships of the user object returned by the API.

org

object

Relationship to an organization.

data [required]

object

Relationship to organization object.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

other_orgs

object

Relationship to organizations.

data [required]

[object]

Relationships to organization objects.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

other_users

object

Relationship to users.

data [required]

[object]

Relationships to user objects.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

roles

object

Relationship to roles.

data [required]

[object]

An array containing type and ID of a role.

id

string

ID of the role.

type

enum

Roles type. Allowed enum values: roles

type [required]

enum

Users resource type. Allowed enum values: users

meta

object

The metadata object containing pagination metadata.

pagination

object

Pagination properties.

next_offset

int64

The index of the first element in the next page of results. Equal to page size added to the current offset.

offset

int64

The index of the first element in the results.

size

int64

Maximum size of pages to return.

{
  "data": [
    {
      "attributes": {
        "created": "2019-09-19T10:00:00.000Z",
        "customer_impact_duration": "integer",
        "customer_impact_end": "2019-09-19T10:00:00.000Z",
        "customer_impact_scope": "An example customer impact scope",
        "customer_impact_start": "2019-09-19T10:00:00.000Z",
        "customer_impacted": false,
        "detected": "2019-09-19T10:00:00.000Z",
        "fields": {
          "<any-key>": {}
        },
        "modified": "2019-09-19T10:00:00.000Z",
        "notification_handles": [
          "@test.user@test.com"
        ],
        "postmortem_id": "00000000-0000-0000-0000-000000000000",
        "public_id": 1,
        "resolved": "2019-09-19T10:00:00.000Z",
        "time_to_detect": "integer",
        "time_to_internal_response": "integer",
        "time_to_repair": "integer",
        "time_to_resolve": "integer",
        "title": "A test incident title"
      },
      "id": "00000000-0000-0000-0000-000000000000",
      "relationships": {
        "commander_user": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "users"
          }
        },
        "created_by_user": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "users"
          }
        },
        "integrations": {
          "data": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "type": "incident_integration_metadata"
            }
          ]
        },
        "last_modified_by_user": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "users"
          }
        },
        "postmortem": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "incident_postmortems"
          }
        }
      },
      "type": "incidents"
    }
  ],
  "included": [
    {
      "attributes": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "disabled": false,
        "email": "string",
        "handle": "string",
        "icon": "string",
        "modified_at": "2019-09-19T10:00:00.000Z",
        "name": "string",
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ],
  "meta": {
    "pagination": {
      "next_offset": 1000,
      "offset": 10,
      "size": 1000
    }
  }
}

Bad Request

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Unauthorized

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/incidents" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    include := []datadog.IncidentRelatedObject{datadog.IncidentRelatedObject("users")} // []IncidentRelatedObject | Specifies which types of related objects should be included in the response. (optional)
    pageSize := int64(789) // int64 | Size for a given page. (optional) (default to 10)
    pageOffset := int64(789) // int64 | Specific offset to use as the beginning of the returned page. (optional) (default to 0)

    configuration := datadog.NewConfiguration()
    configuration.SetUnstableOperationEnabled("ListIncidents", true)

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.IncidentsApi.ListIncidents(ctx).Include(include).PageSize(pageSize).PageOffset(pageOffset).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.ListIncidents``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListIncidents`: IncidentsResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from IncidentsApi.ListIncidents:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.IncidentsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        IncidentsApi apiInstance = new IncidentsApi(defaultClient);
        List<IncidentRelatedObject> include = Arrays.asList(); // List<IncidentRelatedObject> | Specifies which types of related objects should be included in the response.
        Long pageSize = 10L; // Long | Size for a given page.
        Long pageOffset = 0L; // Long | Specific offset to use as the beginning of the returned page.
        try {
	    IncidentsResponse result = apiInstance.listIncidents(new IncidentsApi.ListIncidentsOptionalParameters()
                .include(include)
                .pageSize(pageSize)
                .pageOffset(pageOffset));
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling IncidentsApi#listIncidents");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import incidents_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
configuration.unstable_operations["list_incidents"] = True

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = incidents_api.IncidentsApi(api_client)
    include = [
        IncidentRelatedObject("users"),
    ]  # [IncidentRelatedObject] | Specifies which types of related objects should be included in the response. (optional)
    page_size = 10  # int | Size for a given page. (optional) if omitted the server will use the default value of 10
    page_offset = 0  # int | Specific offset to use as the beginning of the returned page. (optional) if omitted the server will use the default value of 0

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Get a list of incidents
        api_response = api_instance.list_incidents(include=include, page_size=page_size, page_offset=page_offset)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling IncidentsApi->list_incidents: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'

DatadogAPIClient::V2.configure do |config|
  config.unstable_operations[:list_incidents] = true
end

api_instance = DatadogAPIClient::V2::IncidentsAPI.new
opts = {
  include: [DatadogAPIClient::V2::IncidentRelatedObject::USERS], # Array<IncidentRelatedObject> | Specifies which types of related objects should be included in the response.
  page_size: 789, # Integer | Size for a given page.
  page_offset: 789 # Integer | Specific offset to use as the beginning of the returned page.
}

begin
  # Get a list of incidents
  result = api_instance.list_incidents(opts)
  p result
rescue DatadogAPIClient::V2::APIError => e
  puts "Error when calling IncidentsAPI->list_incidents: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

GET https://api.datadoghq.eu/api/v2/incidents/{incident_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}

Présentation

Get the details of an incident by incident_id.

Arguments

Paramètres du chemin

Nom

Type

Description

incident_id [required]

string

The UUID the incident.

Chaînes de requête

Nom

Type

Description

include

array

Specifies which types of related objects should be included in the response.

Réponse

OK

Response with an incident.

Expand All

Champ

Type

Description

data [required]

object

Incident data from a response.

attributes

object

The incident's attributes from a response.

created

date-time

Timestamp when the incident was created.

customer_impact_duration

int64

Length of the incident's customer impact in seconds. Equals the difference between customer_impact_start and customer_impact_end.

customer_impact_end

date-time

Timestamp when customers were no longer impacted by the incident.

customer_impact_scope

string

A summary of the impact customers experienced during the incident.

customer_impact_start

date-time

Timestamp when customers began being impacted by the incident.

customer_impacted

boolean

A flag indicating whether the incident caused customer impact.

detected

date-time

Timestamp when the incident was detected.

fields

object

A condensed view of the user-defined fields attached to incidents.

<any-key>

object <oneOf>

Dynamic fields for which selections can be made, with field names as keys.

Option 1

object

A field with a single value selected.

type

enum

Type of the single value field definitions. Allowed enum values: dropdown,textbox

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

Type of the single value field definitions. Allowed enum values: multiselect,textarray,metrictag,autocomplete

value

[string]

The multiple values selected for this field.

modified

date-time

Timestamp when the incident was last modified.

notification_handles

[string]

Notification handles that will be notified of the incident during update.

postmortem_id

string

The UUID of the postmortem object attached to the incident.

public_id

int64

The monotonically increasing integer ID for the incident.

resolved

date-time

Timestamp when the incident's state was set to resolved.

time_to_detect

int64

The amount of time in seconds to detect the incident. Equals the difference between customer_impact_start and detected.

time_to_internal_response

int64

The amount of time in seconds to call incident after detection. Equals the difference of detected and created.

time_to_repair

int64

The amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between customer_impact_end and detected.

time_to_resolve

int64

The amount of time in seconds to resolve the incident after it was created. Equals the difference between created and resolved.

title [required]

string

The title of the incident, which summarizes what happened.

id [required]

string

The incident's ID.

relationships

object

The incident's relationships from a response.

commander_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

created_by_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

The integration metadata relationship array

id [required]

string

A unique identifier that represents the integration metadata.

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integration_metadata

last_modified_by_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

postmortem

object

A relationship reference for postmortems.

data [required]

object

The postmortem relationship data.

id [required]

string

A unique identifier that represents the postmortem.

type [required]

enum

Incident postmortem resource type. Allowed enum values: incident_postmortems

type [required]

enum

Incident resource type. Allowed enum values: incidents

included

[object <oneOf>]

Included related resources that the user requested.

Option 1

object

User object returned by the API.

attributes

object

Attributes of user object returned by the API.

created_at

date-time

Creation time of the user.

disabled

boolean

Whether the user is disabled.

email

string

Email of the user.

handle

string

Handle of the user.

icon

string

URL of the user's icon.

modified_at

date-time

Time that the user was last modified.

name

string

Name of the user.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id [required]

string

ID of the user.

relationships

object

Relationships of the user object returned by the API.

org

object

Relationship to an organization.

data [required]

object

Relationship to organization object.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

other_orgs

object

Relationship to organizations.

data [required]

[object]

Relationships to organization objects.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

other_users

object

Relationship to users.

data [required]

[object]

Relationships to user objects.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

roles

object

Relationship to roles.

data [required]

[object]

An array containing type and ID of a role.

id

string

ID of the role.

type

enum

Roles type. Allowed enum values: roles

type [required]

enum

Users resource type. Allowed enum values: users

{
  "data": {
    "attributes": {
      "created": "2019-09-19T10:00:00.000Z",
      "customer_impact_duration": "integer",
      "customer_impact_end": "2019-09-19T10:00:00.000Z",
      "customer_impact_scope": "An example customer impact scope",
      "customer_impact_start": "2019-09-19T10:00:00.000Z",
      "customer_impacted": false,
      "detected": "2019-09-19T10:00:00.000Z",
      "fields": {
        "<any-key>": {}
      },
      "modified": "2019-09-19T10:00:00.000Z",
      "notification_handles": [
        "@test.user@test.com"
      ],
      "postmortem_id": "00000000-0000-0000-0000-000000000000",
      "public_id": 1,
      "resolved": "2019-09-19T10:00:00.000Z",
      "time_to_detect": "integer",
      "time_to_internal_response": "integer",
      "time_to_repair": "integer",
      "time_to_resolve": "integer",
      "title": "A test incident title"
    },
    "id": "00000000-0000-0000-0000-000000000000",
    "relationships": {
      "commander_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "integrations": {
        "data": [
          {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "incident_integration_metadata"
          }
        ]
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "postmortem": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "incident_postmortems"
        }
      }
    },
    "type": "incidents"
  },
  "included": [
    {
      "attributes": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "disabled": false,
        "email": "string",
        "handle": "string",
        "icon": "string",
        "modified_at": "2019-09-19T10:00:00.000Z",
        "name": "string",
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Unauthorized

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Path parameters
export incident_id="CHANGE_ME"
# Curl command curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/incidents/${incident_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    incidentId := "incidentId_example" // string | The UUID the incident.
    include := []datadog.IncidentRelatedObject{datadog.IncidentRelatedObject("users")} // []IncidentRelatedObject | Specifies which types of related objects should be included in the response. (optional)

    configuration := datadog.NewConfiguration()
    configuration.SetUnstableOperationEnabled("GetIncident", true)

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.IncidentsApi.GetIncident(ctx, incidentId).Include(include).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.GetIncident``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetIncident`: IncidentResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from IncidentsApi.GetIncident:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.IncidentsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        IncidentsApi apiInstance = new IncidentsApi(defaultClient);
        String incidentId = "incidentId_example"; // String | The UUID the incident.
        List<IncidentRelatedObject> include = Arrays.asList(); // List<IncidentRelatedObject> | Specifies which types of related objects should be included in the response.
        try {
	    IncidentResponse result = apiInstance.getIncident(incidentId, new IncidentsApi.GetIncidentOptionalParameters()
                .include(include));
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling IncidentsApi#getIncident");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import incidents_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
configuration.unstable_operations["get_incident"] = True

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = incidents_api.IncidentsApi(api_client)
    incident_id = "incident_id_example"  # str | The UUID the incident.
    include = [
        IncidentRelatedObject("users"),
    ]  # [IncidentRelatedObject] | Specifies which types of related objects should be included in the response. (optional)

    # example passing only required values which don't have defaults set
    try:
        # Get the details of an incident
        api_response = api_instance.get_incident(incident_id)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling IncidentsApi->get_incident: %s\n" % e)

    # example passing only required values which don't have defaults set
    # and optional values
    try:
        # Get the details of an incident
        api_response = api_instance.get_incident(incident_id, include=include)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling IncidentsApi->get_incident: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'

DatadogAPIClient::V2.configure do |config|
  config.unstable_operations[:get_incident] = true
end

api_instance = DatadogAPIClient::V2::IncidentsAPI.new
incident_id = 'incident_id_example' # String | The UUID the incident.
opts = {
  include: [DatadogAPIClient::V2::IncidentRelatedObject::USERS] # Array<IncidentRelatedObject> | Specifies which types of related objects should be included in the response.
}

begin
  # Get the details of an incident
  result = api_instance.get_incident(incident_id, opts)
  p result
rescue DatadogAPIClient::V2::APIError => e
  puts "Error when calling IncidentsAPI->get_incident: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"

Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.

PATCH https://api.datadoghq.eu/api/v2/incidents/{incident_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}

Présentation

Updates an incident. Provide only the attributes that should be updated as this request is a partial update.

Arguments

Paramètres du chemin

Nom

Type

Description

incident_id [required]

string

The UUID the incident.

Requête

Body Data (required)

Incident Payload.

Expand All

Champ

Type

Description

data [required]

object

Incident data for an update request.

attributes

object

The incident's attributes for an update request.

customer_impact_end

date-time

Timestamp when customers were no longer impacted by the incident.

customer_impact_scope

string

A summary of the impact customers experienced during the incident.

customer_impact_start

date-time

Timestamp when customers began being impacted by the incident.

customer_impacted

boolean

A flag indicating whether the incident caused customer impact.

detected

date-time

Timestamp when the incident was detected.

fields

object

A condensed view of the user-defined fields for which to update selections.

<any-key>

object <oneOf>

Dynamic fields for which selections can be made, with field names as keys.

Option 1

object

A field with a single value selected.

type [required]

enum

Type of the single value field definitions. Allowed enum values: dropdown,textbox

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type [required]

enum

Type of the single value field definitions. Allowed enum values: multiselect,textarray,metrictag,autocomplete

value

[string]

The multiple values selected for this field.

notification_handles

[string]

Notification handles that will be notified of the incident during update.

resolved

date-time

Timestamp when the incident's state was set to resolved.

title

string

The title of the incident, which summarizes what happened.

id [required]

string

The team's ID.

relationships

object

The incident's relationships for an update request.

commander_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

created_by_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

The integration metadata relationship array

id [required]

string

A unique identifier that represents the integration metadata.

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integration_metadata

last_modified_by_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

postmortem

object

A relationship reference for postmortems.

data [required]

object

The postmortem relationship data.

id [required]

string

A unique identifier that represents the postmortem.

type [required]

enum

Incident postmortem resource type. Allowed enum values: incident_postmortems

type [required]

enum

Incident resource type. Allowed enum values: incidents

{
  "data": {
    "attributes": {
      "customer_impact_end": "2019-09-19T10:00:00.000Z",
      "customer_impact_scope": "Example customer impact scope",
      "customer_impact_start": "2019-09-19T10:00:00.000Z",
      "customer_impacted": false,
      "detected": "2019-09-19T10:00:00.000Z",
      "fields": {
        "<any-key>": {}
      },
      "notification_handles": [
        "@test.user@test.com"
      ],
      "resolved": "2019-09-19T10:00:00.000Z",
      "title": "A test incident title"
    },
    "id": "00000000-0000-0000-0000-000000000000",
    "relationships": {
      "commander_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "integrations": {
        "data": [
          {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "incident_integration_metadata"
          }
        ]
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "postmortem": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "incident_postmortems"
        }
      }
    },
    "type": "incidents"
  }
}

Réponse

OK

Response with an incident.

Expand All

Champ

Type

Description

data [required]

object

Incident data from a response.

attributes

object

The incident's attributes from a response.

created

date-time

Timestamp when the incident was created.

customer_impact_duration

int64

Length of the incident's customer impact in seconds. Equals the difference between customer_impact_start and customer_impact_end.

customer_impact_end

date-time

Timestamp when customers were no longer impacted by the incident.

customer_impact_scope

string

A summary of the impact customers experienced during the incident.

customer_impact_start

date-time

Timestamp when customers began being impacted by the incident.

customer_impacted

boolean

A flag indicating whether the incident caused customer impact.

detected

date-time

Timestamp when the incident was detected.

fields

object

A condensed view of the user-defined fields attached to incidents.

<any-key>

object <oneOf>

Dynamic fields for which selections can be made, with field names as keys.

Option 1

object

A field with a single value selected.

type

enum

Type of the single value field definitions. Allowed enum values: dropdown,textbox

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

Type of the single value field definitions. Allowed enum values: multiselect,textarray,metrictag,autocomplete

value

[string]

The multiple values selected for this field.

modified

date-time

Timestamp when the incident was last modified.

notification_handles

[string]

Notification handles that will be notified of the incident during update.

postmortem_id

string

The UUID of the postmortem object attached to the incident.

public_id

int64

The monotonically increasing integer ID for the incident.

resolved

date-time

Timestamp when the incident's state was set to resolved.

time_to_detect

int64

The amount of time in seconds to detect the incident. Equals the difference between customer_impact_start and detected.

time_to_internal_response

int64

The amount of time in seconds to call incident after detection. Equals the difference of detected and created.

time_to_repair

int64

The amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between customer_impact_end and detected.

time_to_resolve

int64

The amount of time in seconds to resolve the incident after it was created. Equals the difference between created and resolved.

title [required]

string

The title of the incident, which summarizes what happened.

id [required]

string

The incident's ID.

relationships

object

The incident's relationships from a response.

commander_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

created_by_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

The integration metadata relationship array

id [required]

string

A unique identifier that represents the integration metadata.

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integration_metadata

last_modified_by_user

object

Relationship to user.

data [required]

object

Relationship to user object.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

postmortem

object

A relationship reference for postmortems.

data [required]

object

The postmortem relationship data.

id [required]

string

A unique identifier that represents the postmortem.

type [required]

enum

Incident postmortem resource type. Allowed enum values: incident_postmortems

type [required]

enum

Incident resource type. Allowed enum values: incidents

included

[object <oneOf>]

Included related resources that the user requested.

Option 1

object

User object returned by the API.

attributes

object

Attributes of user object returned by the API.

created_at

date-time

Creation time of the user.

disabled

boolean

Whether the user is disabled.

email

string

Email of the user.

handle

string

Handle of the user.

icon

string

URL of the user's icon.

modified_at

date-time

Time that the user was last modified.

name

string

Name of the user.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id [required]

string

ID of the user.

relationships

object

Relationships of the user object returned by the API.

org

object

Relationship to an organization.

data [required]

object

Relationship to organization object.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

other_orgs

object

Relationship to organizations.

data [required]

[object]

Relationships to organization objects.

id [required]

string

ID of the organization.

type [required]

enum

Organizations resource type. Allowed enum values: orgs

other_users

object

Relationship to users.

data [required]

[object]

Relationships to user objects.

id [required]

string

A unique identifier that represents the user.

type [required]

enum

Users resource type. Allowed enum values: users

roles

object

Relationship to roles.

data [required]

[object]

An array containing type and ID of a role.

id

string

ID of the role.

type

enum

Roles type. Allowed enum values: roles

type [required]

enum

Users resource type. Allowed enum values: users

{
  "data": {
    "attributes": {
      "created": "2019-09-19T10:00:00.000Z",
      "customer_impact_duration": "integer",
      "customer_impact_end": "2019-09-19T10:00:00.000Z",
      "customer_impact_scope": "An example customer impact scope",
      "customer_impact_start": "2019-09-19T10:00:00.000Z",
      "customer_impacted": false,
      "detected": "2019-09-19T10:00:00.000Z",
      "fields": {
        "<any-key>": {}
      },
      "modified": "2019-09-19T10:00:00.000Z",
      "notification_handles": [
        "@test.user@test.com"
      ],
      "postmortem_id": "00000000-0000-0000-0000-000000000000",
      "public_id": 1,
      "resolved": "2019-09-19T10:00:00.000Z",
      "time_to_detect": "integer",
      "time_to_internal_response": "integer",
      "time_to_repair": "integer",
      "time_to_resolve": "integer",
      "title": "A test incident title"
    },
    "id": "00000000-0000-0000-0000-000000000000",
    "relationships": {
      "commander_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "integrations": {
        "data": [
          {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "incident_integration_metadata"
          }
        ]
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "postmortem": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "incident_postmortems"
        }
      }
    },
    "type": "incidents"
  },
  "included": [
    {
      "attributes": {
        "created_at": "2019-09-19T10:00:00.000Z",
        "disabled": false,
        "email": "string",
        "handle": "string",
        "icon": "string",
        "modified_at": "2019-09-19T10:00:00.000Z",
        "name": "string",
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-0000-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Unauthorized

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Forbidden

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found

API error response.

Expand All

Champ

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Exemple de code


# Path parameters
export incident_id="CHANGE_ME"
# Curl command curl -X PATCH "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/incidents/${incident_id}" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "id": "00000000-0000-0000-0000-000000000000", "relationships": { "commander_user": { "data": { "id": "00000000-0000-0000-0000-000000000000", "type": "users" } }, "created_by_user": { "data": { "id": "00000000-0000-0000-0000-000000000000", "type": "users" } }, "integrations": { "data": [ { "id": "00000000-0000-0000-0000-000000000000", "type": "incident_integration_metadata" } ] }, "last_modified_by_user": { "data": { "id": "00000000-0000-0000-0000-000000000000", "type": "users" } }, "postmortem": { "data": { "id": "00000000-0000-0000-0000-000000000000", "type": "incident_postmortems" } } }, "type": "incidents" } } EOF
package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    incidentId := "incidentId_example" // string | The UUID the incident.
    body := *datadog.NewIncidentUpdateRequest(*datadog.NewIncidentUpdateData("00000000-0000-0000-0000-000000000000", datadog.IncidentType("incidents"))) // IncidentUpdateRequest | Incident Payload.

    configuration := datadog.NewConfiguration()
    configuration.SetUnstableOperationEnabled("UpdateIncident", true)

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.IncidentsApi.UpdateIncident(ctx, incidentId).Body(body).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.UpdateIncident``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateIncident`: IncidentResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from IncidentsApi.UpdateIncident:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.IncidentsApi;

public class Example {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        IncidentsApi apiInstance = new IncidentsApi(defaultClient);
        String incidentId = "incidentId_example"; // String | The UUID the incident.
        IncidentUpdateRequest body = new IncidentUpdateRequest(); // IncidentUpdateRequest | Incident Payload.
        try {
            IncidentResponse result = apiInstance.updateIncident(incidentId, body);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling IncidentsApi#updateIncident");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import incidents_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
configuration.unstable_operations["update_incident"] = True

# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = incidents_api.IncidentsApi(api_client)
    incident_id = "incident_id_example"  # str | The UUID the incident.
    body = IncidentUpdateRequest(
        data=IncidentUpdateData(
            attributes=IncidentUpdateAttributes(
                customer_impact_end=dateutil_parser('1970-01-01T00:00:00.00Z'),
                customer_impact_scope="Example customer impact scope",
                customer_impact_start=dateutil_parser('1970-01-01T00:00:00.00Z'),
                customer_impacted=False,
                detected=dateutil_parser('1970-01-01T00:00:00.00Z'),
                fields={
                    "key": IncidentFieldAttributes(),
                },
                notification_handles=[
                    "@test.user@test.com",
                ],
                resolved=dateutil_parser('1970-01-01T00:00:00.00Z'),
                title="A test incident title",
            ),
            id="00000000-0000-0000-0000-000000000000",
            relationships=IncidentUpdateRelationships(
                commander_user=RelationshipToUser(
                    data=RelationshipToUserData(
                        id="00000000-0000-0000-0000-000000000000",
                        type=UsersType("users"),
                    ),
                ),
                created_by_user=RelationshipToUser(
                    data=RelationshipToUserData(
                        id="00000000-0000-0000-0000-000000000000",
                        type=UsersType("users"),
                    ),
                ),
                integrations=RelationshipToIncidentIntegrationMetadatas(
                    data=[
                        RelationshipToIncidentIntegrationMetadataData(
                            id="00000000-0000-0000-0000-000000000000",
                            type=IncidentIntegrationMetadataType("incident_integration_metadata"),
                        ),
                    ],
                ),
                last_modified_by_user=RelationshipToUser(
                    data=RelationshipToUserData(
                        id="00000000-0000-0000-0000-000000000000",
                        type=UsersType("users"),
                    ),
                ),
                postmortem=RelationshipToIncidentPostmortem(
                    data=RelationshipToIncidentPostmortemData(
                        id="00000000-0000-0000-0000-000000000000",
                        type=IncidentPostmortemType("incident_postmortems"),
                    ),
                ),
            ),
            type=IncidentType("incidents"),
        ),
    )  # IncidentUpdateRequest | Incident Payload.

    # example passing only required values which don't have defaults set
    try:
        # Update an existing incident
        api_response = api_instance.update_incident(incident_id, body)
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling IncidentsApi->update_incident: %s\n" % e)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
require 'datadog_api_client'

DatadogAPIClient::V2.configure do |config|
  config.unstable_operations[:update_incident] = true
end

api_instance = DatadogAPIClient::V2::IncidentsAPI.new
incident_id = 'incident_id_example' # String | The UUID the incident.
body = DatadogAPIClient::V2::IncidentUpdateRequest.new({data: DatadogAPIClient::V2::IncidentUpdateData.new({id: '00000000-0000-0000-0000-000000000000', type: DatadogAPIClient::V2::IncidentType::INCIDENTS})}) # IncidentUpdateRequest | Incident Payload.

begin
  # Update an existing incident
  result = api_instance.update_incident(incident_id, body)
  p result
rescue DatadogAPIClient::V2::APIError => e
  puts "Error when calling IncidentsAPI->update_incident: #{e}"
end

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

              
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"