Incidents

Manage incident response, as well as associated attachments, metadata, and todos. See the Incident Management page for more information.

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

POST https://api.ap1.datadoghq.com/api/v2/incidentshttps://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/incidentshttps://api.us5.datadoghq.com/api/v2/incidents

개요

Create an incident. This endpoint requires the incident_write authorization scope.

요청

Body Data (required)

Incident payload.

Expand All

항목

유형

설명

data [required]

object

Incident data for a create request.

attributes [required]

object

The incident's attributes for a create request.

customer_impact_scope

string

Required if customer_impacted:"true". A summary of the impact customers experienced during the incident.

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>

 <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

default: dropdown

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

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

default: multiselect

value

[string]

The multiple values selected for this field.

initial_cells

[ <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

default: markdown

content [required]

object

The Markdown timeline cell contents.

content

string

The Markdown content of the cell.

important

boolean

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

notification_handles

[object]

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

display_name

string

The name of the notified handle.

handle

string

The email address used for the notification.

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_user [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

default: users

type [required]

enum

Incident resource type. Allowed enum values: incidents

default: incidents

{
  "data": {
    "type": "incidents",
    "attributes": {
      "title": "Example-Incident",
      "customer_impacted": false,
      "fields": {
        "state": {
          "type": "dropdown",
          "value": "resolved"
        }
      }
    },
    "relationships": {
      "commander_user": {
        "data": {
          "type": "users",
          "id": "string"
        }
      }
    }
  }
}

응답

CREATED

Response with an incident.

Expand All

항목

유형

설명

data [required]

object

Incident data from a response.

attributes

object

The incident's attributes from a response.

archived

date-time

Timestamp of when the incident was archived.

case_id

int64

The incident case id.

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>

 <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

default: dropdown

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

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

default: multiselect

value

[string]

The multiple values selected for this field.

modified

date-time

Timestamp when the incident was last modified.

non_datadog_creator

object

Incident's non Datadog creator.

image_48_px

string

Non Datadog creator 48px image.

name

string

Non Datadog creator name.

notification_handles

[object]

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

display_name

string

The name of the notified handle.

handle

string

The email address used for the notification.

public_id

int64

The monotonically increasing integer ID for the incident.

resolved

date-time

Timestamp when the incident's state was last changed from active or stable to resolved or completed.

severity

enum

The incident severity. Allowed enum values: UNKNOWN,SEV-1,SEV-2,SEV-3,SEV-4,SEV-5

state

string

The state incident.

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.

visibility

string

The incident visibility status.

id [required]

string

The incident's ID.

relationships

object

The incident's relationships from a response.

attachments

object

A relationship reference for attachments.

data [required]

[object]

An array of incident attachments.

id [required]

string

A unique identifier that represents the attachment.

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

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

default: 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

default: users

impacts

object

Relationship to impacts.

data [required]

[object]

An array of incident impacts.

id [required]

string

A unique identifier that represents the impact.

type [required]

enum

The incident impacts type. Allowed enum values: incident_impacts

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

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_integrations

default: incident_integrations

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

default: users

responders

object

Relationship to incident responders.

data [required]

[object]

An array of incident responders.

id [required]

string

A unique identifier that represents the responder.

type [required]

enum

The incident responders type. Allowed enum values: incident_responders

user_defined_fields

object

Relationship to incident user defined fields.

data [required]

[object]

An array of user defined fields.

id [required]

string

A unique identifier that represents the responder.

type [required]

enum

The incident user defined fields type. Allowed enum values: user_defined_field

type [required]

enum

Incident resource type. Allowed enum values: incidents

default: incidents

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

Option 2

object

A single incident attachment.

attributes [required]

 <oneOf>

The attributes object for an attachment.

Option 1

object

The attributes object for a postmortem attachment.

attachment [required]

object

The postmortem attachment.

documentUrl [required]

string

The URL of this notebook attachment.

title [required]

string

The title of this postmortem attachment.

attachment_type [required]

enum

The type of postmortem attachment attributes. Allowed enum values: postmortem

default: postmortem

Option 2

object

The attributes object for a link attachment.

attachment [required]

object

The link attachment.

documentUrl [required]

string

The URL of this link attachment.

title [required]

string

The title of this link attachment.

attachment_type [required]

enum

The type of link attachment attributes. Allowed enum values: link

default: link

modified

date-time

Timestamp when the incident attachment link was last modified.

id [required]

string

A unique identifier that represents the incident attachment.

relationships [required]

object

The incident attachment's relationships.

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

default: users

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

{
  "data": {
    "attributes": {
      "archived": "2019-09-19T10:00:00.000Z",
      "case_id": "integer",
      "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>": "undefined"
      },
      "modified": "2019-09-19T10:00:00.000Z",
      "non_datadog_creator": {
        "image_48_px": "string",
        "name": "string"
      },
      "notification_handles": [
        {
          "display_name": "Jane Doe",
          "handle": "@test.user@test.com"
        }
      ],
      "public_id": 1,
      "resolved": "2019-09-19T10:00:00.000Z",
      "severity": "UNKNOWN",
      "state": "string",
      "time_to_detect": "integer",
      "time_to_internal_response": "integer",
      "time_to_repair": "integer",
      "time_to_resolve": "integer",
      "title": "A test incident title",
      "visibility": "string"
    },
    "id": "00000000-0000-0000-1234-000000000000",
    "relationships": {
      "attachments": {
        "data": [
          {
            "id": "00000000-0000-abcd-1000-000000000000",
            "type": "incident_attachments"
          }
        ]
      },
      "commander_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "impacts": {
        "data": [
          {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "incident_impacts"
          }
        ]
      },
      "integrations": {
        "data": [
          {
            "id": "00000000-abcd-0001-0000-000000000000",
            "type": "incident_integrations"
          }
        ]
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "responders": {
        "data": [
          {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "incident_responders"
          }
        ]
      },
      "user_defined_fields": {
        "data": [
          {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "user_defined_field"
          }
        ]
      }
    },
    "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                          # Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "type": "incidents", "attributes": { "title": "Example-Incident", "customer_impacted": false, "fields": { "state": { "type": "dropdown", "value": "resolved" } } }, "relationships": { "commander_user": { "data": { "type": "users", "id": "string" } } } } } EOF
// Create an incident returns "CREATED" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "user" in the system
	UserDataID := os.Getenv("USER_DATA_ID")

	body := datadogV2.IncidentCreateRequest{
		Data: datadogV2.IncidentCreateData{
			Type: datadogV2.INCIDENTTYPE_INCIDENTS,
			Attributes: datadogV2.IncidentCreateAttributes{
				Title:            "Example-Incident",
				CustomerImpacted: false,
				Fields: map[string]datadogV2.IncidentFieldAttributes{
					"state": datadogV2.IncidentFieldAttributes{
						IncidentFieldAttributesSingleValue: &datadogV2.IncidentFieldAttributesSingleValue{
							Type:  datadogV2.INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN.Ptr(),
							Value: *datadog.NewNullableString(datadog.PtrString("resolved")),
						}},
				},
			},
			Relationships: &datadogV2.IncidentCreateRelationships{
				CommanderUser: *datadogV2.NewNullableNullableRelationshipToUser(&datadogV2.NullableRelationshipToUser{
					Data: *datadogV2.NewNullableNullableRelationshipToUserData(&datadogV2.NullableRelationshipToUserData{
						Type: datadogV2.USERSTYPE_USERS,
						Id:   UserDataID,
					}),
				}),
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.CreateIncident", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.CreateIncident(ctx, body)

	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)
	}

	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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create an incident returns "CREATED" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentCreateAttributes;
import com.datadog.api.client.v2.model.IncidentCreateData;
import com.datadog.api.client.v2.model.IncidentCreateRelationships;
import com.datadog.api.client.v2.model.IncidentCreateRequest;
import com.datadog.api.client.v2.model.IncidentFieldAttributes;
import com.datadog.api.client.v2.model.IncidentFieldAttributesSingleValue;
import com.datadog.api.client.v2.model.IncidentFieldAttributesSingleValueType;
import com.datadog.api.client.v2.model.IncidentResponse;
import com.datadog.api.client.v2.model.IncidentType;
import com.datadog.api.client.v2.model.NullableRelationshipToUser;
import com.datadog.api.client.v2.model.NullableRelationshipToUserData;
import com.datadog.api.client.v2.model.UsersType;
import java.util.Map;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.createIncident", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "user" in the system
    String USER_DATA_ID = System.getenv("USER_DATA_ID");

    IncidentCreateRequest body =
        new IncidentCreateRequest()
            .data(
                new IncidentCreateData()
                    .type(IncidentType.INCIDENTS)
                    .attributes(
                        new IncidentCreateAttributes()
                            .title("Example-Incident")
                            .customerImpacted(false)
                            .fields(
                                Map.ofEntries(
                                    Map.entry(
                                        "state",
                                        new IncidentFieldAttributes(
                                            new IncidentFieldAttributesSingleValue()
                                                .type(
                                                    IncidentFieldAttributesSingleValueType.DROPDOWN)
                                                .value("resolved"))))))
                    .relationships(
                        new IncidentCreateRelationships()
                            .commanderUser(
                                new NullableRelationshipToUser()
                                    .data(
                                        new NullableRelationshipToUserData()
                                            .type(UsersType.USERS)
                                            .id(USER_DATA_ID)))));

    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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create an incident returns "CREATED" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_create_attributes import IncidentCreateAttributes
from datadog_api_client.v2.model.incident_create_data import IncidentCreateData
from datadog_api_client.v2.model.incident_create_relationships import IncidentCreateRelationships
from datadog_api_client.v2.model.incident_create_request import IncidentCreateRequest
from datadog_api_client.v2.model.incident_field_attributes_single_value import IncidentFieldAttributesSingleValue
from datadog_api_client.v2.model.incident_field_attributes_single_value_type import (
    IncidentFieldAttributesSingleValueType,
)
from datadog_api_client.v2.model.incident_type import IncidentType
from datadog_api_client.v2.model.nullable_relationship_to_user import NullableRelationshipToUser
from datadog_api_client.v2.model.nullable_relationship_to_user_data import NullableRelationshipToUserData
from datadog_api_client.v2.model.users_type import UsersType

# there is a valid "user" in the system
USER_DATA_ID = environ["USER_DATA_ID"]

body = IncidentCreateRequest(
    data=IncidentCreateData(
        type=IncidentType.INCIDENTS,
        attributes=IncidentCreateAttributes(
            title="Example-Incident",
            customer_impacted=False,
            fields=dict(
                state=IncidentFieldAttributesSingleValue(
                    type=IncidentFieldAttributesSingleValueType.DROPDOWN,
                    value="resolved",
                ),
            ),
        ),
        relationships=IncidentCreateRelationships(
            commander_user=NullableRelationshipToUser(
                data=NullableRelationshipToUserData(
                    type=UsersType.USERS,
                    id=USER_DATA_ID,
                ),
            ),
        ),
    ),
)

configuration = Configuration()
configuration.unstable_operations["create_incident"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.create_incident(body=body)

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create an incident returns "CREATED" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.create_incident".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "user" in the system
USER_DATA_ID = ENV["USER_DATA_ID"]

body = DatadogAPIClient::V2::IncidentCreateRequest.new({
  data: DatadogAPIClient::V2::IncidentCreateData.new({
    type: DatadogAPIClient::V2::IncidentType::INCIDENTS,
    attributes: DatadogAPIClient::V2::IncidentCreateAttributes.new({
      title: "Example-Incident",
      customer_impacted: false,
      fields: {
        state: DatadogAPIClient::V2::IncidentFieldAttributesSingleValue.new({
          type: DatadogAPIClient::V2::IncidentFieldAttributesSingleValueType::DROPDOWN,
          value: "resolved",
        }),
      },
    }),
    relationships: DatadogAPIClient::V2::IncidentCreateRelationships.new({
      commander_user: DatadogAPIClient::V2::NullableRelationshipToUser.new({
        data: DatadogAPIClient::V2::NullableRelationshipToUserData.new({
          type: DatadogAPIClient::V2::UsersType::USERS,
          id: USER_DATA_ID,
        }),
      }),
    }),
  }),
})
p api_instance.create_incident(body)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Create an incident returns "CREATED" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.createIncident"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "user" in the system
const USER_DATA_ID = process.env.USER_DATA_ID as string;

const params: v2.IncidentsApiCreateIncidentRequest = {
  body: {
    data: {
      type: "incidents",
      attributes: {
        title: "Example-Incident",
        customerImpacted: false,
        fields: {
          state: {
            type: "dropdown",
            value: "resolved",
          },
        },
      },
      relationships: {
        commanderUser: {
          data: {
            type: "users",
            id: USER_DATA_ID,
          },
        },
      },
    },
  },
};

apiInstance
  .createIncident(params)
  .then((data: v2.IncidentResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

GET https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}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}https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}

개요

Get the details of an incident by incident_id. This endpoint requires the incident_read authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

Query Strings

이름

유형

설명

include

array

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

응답

OK

Response with an incident.

Expand All

항목

유형

설명

data [required]

object

Incident data from a response.

attributes

object

The incident's attributes from a response.

archived

date-time

Timestamp of when the incident was archived.

case_id

int64

The incident case id.

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>

 <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

default: dropdown

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

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

default: multiselect

value

[string]

The multiple values selected for this field.

modified

date-time

Timestamp when the incident was last modified.

non_datadog_creator

object

Incident's non Datadog creator.

image_48_px

string

Non Datadog creator 48px image.

name

string

Non Datadog creator name.

notification_handles

[object]

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

display_name

string

The name of the notified handle.

handle

string

The email address used for the notification.

public_id

int64

The monotonically increasing integer ID for the incident.

resolved

date-time

Timestamp when the incident's state was last changed from active or stable to resolved or completed.

severity

enum

The incident severity. Allowed enum values: UNKNOWN,SEV-1,SEV-2,SEV-3,SEV-4,SEV-5

state

string

The state incident.

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.

visibility

string

The incident visibility status.

id [required]

string

The incident's ID.

relationships

object

The incident's relationships from a response.

attachments

object

A relationship reference for attachments.

data [required]

[object]

An array of incident attachments.

id [required]

string

A unique identifier that represents the attachment.

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

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

default: 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

default: users

impacts

object

Relationship to impacts.

data [required]

[object]

An array of incident impacts.

id [required]

string

A unique identifier that represents the impact.

type [required]

enum

The incident impacts type. Allowed enum values: incident_impacts

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

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_integrations

default: incident_integrations

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

default: users

responders

object

Relationship to incident responders.

data [required]

[object]

An array of incident responders.

id [required]

string

A unique identifier that represents the responder.

type [required]

enum

The incident responders type. Allowed enum values: incident_responders

user_defined_fields

object

Relationship to incident user defined fields.

data [required]

[object]

An array of user defined fields.

id [required]

string

A unique identifier that represents the responder.

type [required]

enum

The incident user defined fields type. Allowed enum values: user_defined_field

type [required]

enum

Incident resource type. Allowed enum values: incidents

default: incidents

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

Option 2

object

A single incident attachment.

attributes [required]

 <oneOf>

The attributes object for an attachment.

Option 1

object

The attributes object for a postmortem attachment.

attachment [required]

object

The postmortem attachment.

documentUrl [required]

string

The URL of this notebook attachment.

title [required]

string

The title of this postmortem attachment.

attachment_type [required]

enum

The type of postmortem attachment attributes. Allowed enum values: postmortem

default: postmortem

Option 2

object

The attributes object for a link attachment.

attachment [required]

object

The link attachment.

documentUrl [required]

string

The URL of this link attachment.

title [required]

string

The title of this link attachment.

attachment_type [required]

enum

The type of link attachment attributes. Allowed enum values: link

default: link

modified

date-time

Timestamp when the incident attachment link was last modified.

id [required]

string

A unique identifier that represents the incident attachment.

relationships [required]

object

The incident attachment's relationships.

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

default: users

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

{
  "data": {
    "attributes": {
      "archived": "2019-09-19T10:00:00.000Z",
      "case_id": "integer",
      "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>": "undefined"
      },
      "modified": "2019-09-19T10:00:00.000Z",
      "non_datadog_creator": {
        "image_48_px": "string",
        "name": "string"
      },
      "notification_handles": [
        {
          "display_name": "Jane Doe",
          "handle": "@test.user@test.com"
        }
      ],
      "public_id": 1,
      "resolved": "2019-09-19T10:00:00.000Z",
      "severity": "UNKNOWN",
      "state": "string",
      "time_to_detect": "integer",
      "time_to_internal_response": "integer",
      "time_to_repair": "integer",
      "time_to_resolve": "integer",
      "title": "A test incident title",
      "visibility": "string"
    },
    "id": "00000000-0000-0000-1234-000000000000",
    "relationships": {
      "attachments": {
        "data": [
          {
            "id": "00000000-0000-abcd-1000-000000000000",
            "type": "incident_attachments"
          }
        ]
      },
      "commander_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "impacts": {
        "data": [
          {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "incident_impacts"
          }
        ]
      },
      "integrations": {
        "data": [
          {
            "id": "00000000-abcd-0001-0000-000000000000",
            "type": "incident_integrations"
          }
        ]
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "responders": {
        "data": [
          {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "incident_responders"
          }
        ]
      },
      "user_defined_fields": {
        "data": [
          {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "user_defined_field"
          }
        ]
      }
    },
    "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get the details of an incident returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

configuration = Configuration()
configuration.unstable_operations["get_incident"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.get_incident(
        incident_id=INCIDENT_DATA_ID,
    )

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get the details of an incident returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.get_incident".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]
p api_instance.get_incident(INCIDENT_DATA_ID)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get the details of an incident returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.GetIncident", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.GetIncident(ctx, IncidentDataID, *datadogV2.NewGetIncidentOptionalParameters())

	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)
	}

	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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get the details of an incident returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.getIncident", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    try {
      IncidentResponse result = apiInstance.getIncident(INCIDENT_DATA_ID);
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get the details of an incident returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.getIncident"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

const params: v2.IncidentsApiGetIncidentRequest = {
  incidentId: INCIDENT_DATA_ID,
};

apiInstance
  .getIncident(params)
  .then((data: v2.IncidentResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

PATCH https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}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}https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}

개요

Updates an incident. Provide only the attributes that should be updated as this request is a partial update. This endpoint requires the incident_write authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

Query Strings

이름

유형

설명

include

array

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

요청

Body Data (required)

Incident Payload.

Expand All

항목

유형

설명

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>

 <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

default: dropdown

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

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

default: multiselect

value

[string]

The multiple values selected for this field.

notification_handles

[object]

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

display_name

string

The name of the notified handle.

handle

string

The email address used for the notification.

title

string

The title of the incident, which summarizes what happened.

id [required]

string

The incident'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

default: users

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

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_integrations

default: incident_integrations

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

default: incident_postmortems

type [required]

enum

Incident resource type. Allowed enum values: incidents

default: incidents

{
  "data": {
    "id": "00000000-0000-0000-1234-000000000000",
    "type": "incidents",
    "relationships": {
      "commander_user": {
        "data": {
          "id": "string",
          "type": "users"
        }
      }
    }
  }
}
{
  "data": {
    "id": "00000000-0000-0000-1234-000000000000",
    "type": "incidents",
    "relationships": {
      "commander_user": {
        "data": null
      }
    }
  }
}
{
  "data": {
    "id": "00000000-0000-0000-1234-000000000000",
    "type": "incidents",
    "attributes": {
      "fields": {
        "state": {
          "type": "dropdown",
          "value": "resolved"
        }
      },
      "title": "A test incident title-updated"
    }
  }
}

응답

OK

Response with an incident.

Expand All

항목

유형

설명

data [required]

object

Incident data from a response.

attributes

object

The incident's attributes from a response.

archived

date-time

Timestamp of when the incident was archived.

case_id

int64

The incident case id.

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>

 <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

default: dropdown

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

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

default: multiselect

value

[string]

The multiple values selected for this field.

modified

date-time

Timestamp when the incident was last modified.

non_datadog_creator

object

Incident's non Datadog creator.

image_48_px

string

Non Datadog creator 48px image.

name

string

Non Datadog creator name.

notification_handles

[object]

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

display_name

string

The name of the notified handle.

handle

string

The email address used for the notification.

public_id

int64

The monotonically increasing integer ID for the incident.

resolved

date-time

Timestamp when the incident's state was last changed from active or stable to resolved or completed.

severity

enum

The incident severity. Allowed enum values: UNKNOWN,SEV-1,SEV-2,SEV-3,SEV-4,SEV-5

state

string

The state incident.

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.

visibility

string

The incident visibility status.

id [required]

string

The incident's ID.

relationships

object

The incident's relationships from a response.

attachments

object

A relationship reference for attachments.

data [required]

[object]

An array of incident attachments.

id [required]

string

A unique identifier that represents the attachment.

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

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

default: 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

default: users

impacts

object

Relationship to impacts.

data [required]

[object]

An array of incident impacts.

id [required]

string

A unique identifier that represents the impact.

type [required]

enum

The incident impacts type. Allowed enum values: incident_impacts

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

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_integrations

default: incident_integrations

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

default: users

responders

object

Relationship to incident responders.

data [required]

[object]

An array of incident responders.

id [required]

string

A unique identifier that represents the responder.

type [required]

enum

The incident responders type. Allowed enum values: incident_responders

user_defined_fields

object

Relationship to incident user defined fields.

data [required]

[object]

An array of user defined fields.

id [required]

string

A unique identifier that represents the responder.

type [required]

enum

The incident user defined fields type. Allowed enum values: user_defined_field

type [required]

enum

Incident resource type. Allowed enum values: incidents

default: incidents

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

Option 2

object

A single incident attachment.

attributes [required]

 <oneOf>

The attributes object for an attachment.

Option 1

object

The attributes object for a postmortem attachment.

attachment [required]

object

The postmortem attachment.

documentUrl [required]

string

The URL of this notebook attachment.

title [required]

string

The title of this postmortem attachment.

attachment_type [required]

enum

The type of postmortem attachment attributes. Allowed enum values: postmortem

default: postmortem

Option 2

object

The attributes object for a link attachment.

attachment [required]

object

The link attachment.

documentUrl [required]

string

The URL of this link attachment.

title [required]

string

The title of this link attachment.

attachment_type [required]

enum

The type of link attachment attributes. Allowed enum values: link

default: link

modified

date-time

Timestamp when the incident attachment link was last modified.

id [required]

string

A unique identifier that represents the incident attachment.

relationships [required]

object

The incident attachment's relationships.

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

default: users

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

{
  "data": {
    "attributes": {
      "archived": "2019-09-19T10:00:00.000Z",
      "case_id": "integer",
      "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>": "undefined"
      },
      "modified": "2019-09-19T10:00:00.000Z",
      "non_datadog_creator": {
        "image_48_px": "string",
        "name": "string"
      },
      "notification_handles": [
        {
          "display_name": "Jane Doe",
          "handle": "@test.user@test.com"
        }
      ],
      "public_id": 1,
      "resolved": "2019-09-19T10:00:00.000Z",
      "severity": "UNKNOWN",
      "state": "string",
      "time_to_detect": "integer",
      "time_to_internal_response": "integer",
      "time_to_repair": "integer",
      "time_to_resolve": "integer",
      "title": "A test incident title",
      "visibility": "string"
    },
    "id": "00000000-0000-0000-1234-000000000000",
    "relationships": {
      "attachments": {
        "data": [
          {
            "id": "00000000-0000-abcd-1000-000000000000",
            "type": "incident_attachments"
          }
        ]
      },
      "commander_user": {
        "data": {
          "id": "00000000-0000-0000-0000-000000000000",
          "type": "users"
        }
      },
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "impacts": {
        "data": [
          {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "incident_impacts"
          }
        ]
      },
      "integrations": {
        "data": [
          {
            "id": "00000000-abcd-0001-0000-000000000000",
            "type": "incident_integrations"
          }
        ]
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "responders": {
        "data": [
          {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "incident_responders"
          }
        ]
      },
      "user_defined_fields": {
        "data": [
          {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "user_defined_field"
          }
        ]
      }
    },
    "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                          # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}" \ -H "Accept: application/json" \ -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-1234-000000000000", "type": "incidents", "relationships": { "commander_user": { "data": { "id": "string", "type": "users" } } } } } EOF
                          # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}" \ -H "Accept: application/json" \ -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-1234-000000000000", "type": "incidents", "relationships": { "commander_user": { "data": null } } } } EOF
                          # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}" \ -H "Accept: application/json" \ -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-1234-000000000000", "type": "incidents", "attributes": { "fields": { "state": { "type": "dropdown", "value": "resolved" } }, "title": "A test incident title-updated" } } } EOF
// Add commander to an incident returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	// there is a valid "user" in the system
	UserDataID := os.Getenv("USER_DATA_ID")

	body := datadogV2.IncidentUpdateRequest{
		Data: datadogV2.IncidentUpdateData{
			Id:   IncidentDataID,
			Type: datadogV2.INCIDENTTYPE_INCIDENTS,
			Relationships: &datadogV2.IncidentUpdateRelationships{
				CommanderUser: *datadogV2.NewNullableNullableRelationshipToUser(&datadogV2.NullableRelationshipToUser{
					Data: *datadogV2.NewNullableNullableRelationshipToUserData(&datadogV2.NullableRelationshipToUserData{
						Id:   UserDataID,
						Type: datadogV2.USERSTYPE_USERS,
					}),
				}),
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.UpdateIncident", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.UpdateIncident(ctx, IncidentDataID, body, *datadogV2.NewUpdateIncidentOptionalParameters())

	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)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.UpdateIncident`:\n%s\n", responseContent)
}
// Remove commander from an incident returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	body := datadogV2.IncidentUpdateRequest{
		Data: datadogV2.IncidentUpdateData{
			Id:   IncidentDataID,
			Type: datadogV2.INCIDENTTYPE_INCIDENTS,
			Relationships: &datadogV2.IncidentUpdateRelationships{
				CommanderUser: *datadogV2.NewNullableNullableRelationshipToUser(&datadogV2.NullableRelationshipToUser{
					Data: *datadogV2.NewNullableNullableRelationshipToUserData(nil),
				}),
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.UpdateIncident", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.UpdateIncident(ctx, IncidentDataID, body, *datadogV2.NewUpdateIncidentOptionalParameters())

	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)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.UpdateIncident`:\n%s\n", responseContent)
}
// Update an existing incident returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	body := datadogV2.IncidentUpdateRequest{
		Data: datadogV2.IncidentUpdateData{
			Id:   IncidentDataID,
			Type: datadogV2.INCIDENTTYPE_INCIDENTS,
			Attributes: &datadogV2.IncidentUpdateAttributes{
				Fields: map[string]datadogV2.IncidentFieldAttributes{
					"state": datadogV2.IncidentFieldAttributes{
						IncidentFieldAttributesSingleValue: &datadogV2.IncidentFieldAttributesSingleValue{
							Type:  datadogV2.INCIDENTFIELDATTRIBUTESSINGLEVALUETYPE_DROPDOWN.Ptr(),
							Value: *datadog.NewNullableString(datadog.PtrString("resolved")),
						}},
				},
				Title: datadog.PtrString("A test incident title-updated"),
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.UpdateIncident", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.UpdateIncident(ctx, IncidentDataID, body, *datadogV2.NewUpdateIncidentOptionalParameters())

	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)
	}

	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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Add commander to an incident returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentResponse;
import com.datadog.api.client.v2.model.IncidentType;
import com.datadog.api.client.v2.model.IncidentUpdateData;
import com.datadog.api.client.v2.model.IncidentUpdateRelationships;
import com.datadog.api.client.v2.model.IncidentUpdateRequest;
import com.datadog.api.client.v2.model.NullableRelationshipToUser;
import com.datadog.api.client.v2.model.NullableRelationshipToUserData;
import com.datadog.api.client.v2.model.UsersType;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.updateIncident", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    // there is a valid "user" in the system
    String USER_DATA_ID = System.getenv("USER_DATA_ID");

    IncidentUpdateRequest body =
        new IncidentUpdateRequest()
            .data(
                new IncidentUpdateData()
                    .id(INCIDENT_DATA_ID)
                    .type(IncidentType.INCIDENTS)
                    .relationships(
                        new IncidentUpdateRelationships()
                            .commanderUser(
                                new NullableRelationshipToUser()
                                    .data(
                                        new NullableRelationshipToUserData()
                                            .id(USER_DATA_ID)
                                            .type(UsersType.USERS)))));

    try {
      IncidentResponse result = apiInstance.updateIncident(INCIDENT_DATA_ID, 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();
    }
  }
}
// Remove commander from an incident returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentResponse;
import com.datadog.api.client.v2.model.IncidentType;
import com.datadog.api.client.v2.model.IncidentUpdateData;
import com.datadog.api.client.v2.model.IncidentUpdateRelationships;
import com.datadog.api.client.v2.model.IncidentUpdateRequest;
import com.datadog.api.client.v2.model.NullableRelationshipToUser;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.updateIncident", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    IncidentUpdateRequest body =
        new IncidentUpdateRequest()
            .data(
                new IncidentUpdateData()
                    .id(INCIDENT_DATA_ID)
                    .type(IncidentType.INCIDENTS)
                    .relationships(
                        new IncidentUpdateRelationships()
                            .commanderUser(new NullableRelationshipToUser().data(null))));

    try {
      IncidentResponse result = apiInstance.updateIncident(INCIDENT_DATA_ID, 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();
    }
  }
}
// Update an existing incident returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentFieldAttributes;
import com.datadog.api.client.v2.model.IncidentFieldAttributesSingleValue;
import com.datadog.api.client.v2.model.IncidentFieldAttributesSingleValueType;
import com.datadog.api.client.v2.model.IncidentResponse;
import com.datadog.api.client.v2.model.IncidentType;
import com.datadog.api.client.v2.model.IncidentUpdateAttributes;
import com.datadog.api.client.v2.model.IncidentUpdateData;
import com.datadog.api.client.v2.model.IncidentUpdateRequest;
import java.util.Map;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.updateIncident", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ATTRIBUTES_TITLE = System.getenv("INCIDENT_DATA_ATTRIBUTES_TITLE");
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    IncidentUpdateRequest body =
        new IncidentUpdateRequest()
            .data(
                new IncidentUpdateData()
                    .id(INCIDENT_DATA_ID)
                    .type(IncidentType.INCIDENTS)
                    .attributes(
                        new IncidentUpdateAttributes()
                            .fields(
                                Map.ofEntries(
                                    Map.entry(
                                        "state",
                                        new IncidentFieldAttributes(
                                            new IncidentFieldAttributesSingleValue()
                                                .type(
                                                    IncidentFieldAttributesSingleValueType.DROPDOWN)
                                                .value("resolved")))))
                            .title("A test incident title-updated")));

    try {
      IncidentResponse result = apiInstance.updateIncident(INCIDENT_DATA_ID, 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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Add commander to an incident returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_type import IncidentType
from datadog_api_client.v2.model.incident_update_data import IncidentUpdateData
from datadog_api_client.v2.model.incident_update_relationships import IncidentUpdateRelationships
from datadog_api_client.v2.model.incident_update_request import IncidentUpdateRequest
from datadog_api_client.v2.model.nullable_relationship_to_user import NullableRelationshipToUser
from datadog_api_client.v2.model.nullable_relationship_to_user_data import NullableRelationshipToUserData
from datadog_api_client.v2.model.users_type import UsersType

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

# there is a valid "user" in the system
USER_DATA_ID = environ["USER_DATA_ID"]

body = IncidentUpdateRequest(
    data=IncidentUpdateData(
        id=INCIDENT_DATA_ID,
        type=IncidentType.INCIDENTS,
        relationships=IncidentUpdateRelationships(
            commander_user=NullableRelationshipToUser(
                data=NullableRelationshipToUserData(
                    id=USER_DATA_ID,
                    type=UsersType.USERS,
                ),
            ),
        ),
    ),
)

configuration = Configuration()
configuration.unstable_operations["update_incident"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.update_incident(incident_id=INCIDENT_DATA_ID, body=body)

    print(response)
"""
Remove commander from an incident returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_type import IncidentType
from datadog_api_client.v2.model.incident_update_data import IncidentUpdateData
from datadog_api_client.v2.model.incident_update_relationships import IncidentUpdateRelationships
from datadog_api_client.v2.model.incident_update_request import IncidentUpdateRequest
from datadog_api_client.v2.model.nullable_relationship_to_user import NullableRelationshipToUser

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

body = IncidentUpdateRequest(
    data=IncidentUpdateData(
        id=INCIDENT_DATA_ID,
        type=IncidentType.INCIDENTS,
        relationships=IncidentUpdateRelationships(
            commander_user=NullableRelationshipToUser(
                data=None,
            ),
        ),
    ),
)

configuration = Configuration()
configuration.unstable_operations["update_incident"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.update_incident(incident_id=INCIDENT_DATA_ID, body=body)

    print(response)
"""
Update an existing incident returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_field_attributes_single_value import IncidentFieldAttributesSingleValue
from datadog_api_client.v2.model.incident_field_attributes_single_value_type import (
    IncidentFieldAttributesSingleValueType,
)
from datadog_api_client.v2.model.incident_type import IncidentType
from datadog_api_client.v2.model.incident_update_attributes import IncidentUpdateAttributes
from datadog_api_client.v2.model.incident_update_data import IncidentUpdateData
from datadog_api_client.v2.model.incident_update_request import IncidentUpdateRequest

# there is a valid "incident" in the system
INCIDENT_DATA_ATTRIBUTES_TITLE = environ["INCIDENT_DATA_ATTRIBUTES_TITLE"]
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

body = IncidentUpdateRequest(
    data=IncidentUpdateData(
        id=INCIDENT_DATA_ID,
        type=IncidentType.INCIDENTS,
        attributes=IncidentUpdateAttributes(
            fields=dict(
                state=IncidentFieldAttributesSingleValue(
                    type=IncidentFieldAttributesSingleValueType.DROPDOWN,
                    value="resolved",
                ),
            ),
            title="A test incident title-updated",
        ),
    ),
)

configuration = Configuration()
configuration.unstable_operations["update_incident"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.update_incident(incident_id=INCIDENT_DATA_ID, body=body)

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Add commander to an incident returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.update_incident".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

# there is a valid "user" in the system
USER_DATA_ID = ENV["USER_DATA_ID"]

body = DatadogAPIClient::V2::IncidentUpdateRequest.new({
  data: DatadogAPIClient::V2::IncidentUpdateData.new({
    id: INCIDENT_DATA_ID,
    type: DatadogAPIClient::V2::IncidentType::INCIDENTS,
    relationships: DatadogAPIClient::V2::IncidentUpdateRelationships.new({
      commander_user: DatadogAPIClient::V2::NullableRelationshipToUser.new({
        data: DatadogAPIClient::V2::NullableRelationshipToUserData.new({
          id: USER_DATA_ID,
          type: DatadogAPIClient::V2::UsersType::USERS,
        }),
      }),
    }),
  }),
})
p api_instance.update_incident(INCIDENT_DATA_ID, body)
# Remove commander from an incident returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.update_incident".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

body = DatadogAPIClient::V2::IncidentUpdateRequest.new({
  data: DatadogAPIClient::V2::IncidentUpdateData.new({
    id: INCIDENT_DATA_ID,
    type: DatadogAPIClient::V2::IncidentType::INCIDENTS,
    relationships: DatadogAPIClient::V2::IncidentUpdateRelationships.new({
      commander_user: DatadogAPIClient::V2::NullableRelationshipToUser.new({
        data: nil,
      }),
    }),
  }),
})
p api_instance.update_incident(INCIDENT_DATA_ID, body)
# Update an existing incident returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.update_incident".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ATTRIBUTES_TITLE = ENV["INCIDENT_DATA_ATTRIBUTES_TITLE"]
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

body = DatadogAPIClient::V2::IncidentUpdateRequest.new({
  data: DatadogAPIClient::V2::IncidentUpdateData.new({
    id: INCIDENT_DATA_ID,
    type: DatadogAPIClient::V2::IncidentType::INCIDENTS,
    attributes: DatadogAPIClient::V2::IncidentUpdateAttributes.new({
      fields: {
        state: DatadogAPIClient::V2::IncidentFieldAttributesSingleValue.new({
          type: DatadogAPIClient::V2::IncidentFieldAttributesSingleValueType::DROPDOWN,
          value: "resolved",
        }),
      },
      title: "A test incident title-updated",
    }),
  }),
})
p api_instance.update_incident(INCIDENT_DATA_ID, body)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Add commander to an incident returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.updateIncident"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

// there is a valid "user" in the system
const USER_DATA_ID = process.env.USER_DATA_ID as string;

const params: v2.IncidentsApiUpdateIncidentRequest = {
  body: {
    data: {
      id: INCIDENT_DATA_ID,
      type: "incidents",
      relationships: {
        commanderUser: {
          data: {
            id: USER_DATA_ID,
            type: "users",
          },
        },
      },
    },
  },
  incidentId: INCIDENT_DATA_ID,
};

apiInstance
  .updateIncident(params)
  .then((data: v2.IncidentResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Remove commander from an incident returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.updateIncident"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

const params: v2.IncidentsApiUpdateIncidentRequest = {
  body: {
    data: {
      id: INCIDENT_DATA_ID,
      type: "incidents",
      relationships: {
        commanderUser: {
          data: null,
        },
      },
    },
  },
  incidentId: INCIDENT_DATA_ID,
};

apiInstance
  .updateIncident(params)
  .then((data: v2.IncidentResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));
/**
 * Update an existing incident returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.updateIncident"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

const params: v2.IncidentsApiUpdateIncidentRequest = {
  body: {
    data: {
      id: INCIDENT_DATA_ID,
      type: "incidents",
      attributes: {
        fields: {
          state: {
            type: "dropdown",
            value: "resolved",
          },
        },
        title: "A test incident title-updated",
      },
    },
  },
  incidentId: INCIDENT_DATA_ID,
};

apiInstance
  .updateIncident(params)
  .then((data: v2.IncidentResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

DELETE https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}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}https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}

개요

Deletes an existing incident from the users organization. This endpoint requires the incident_write authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

응답

OK

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete an existing incident returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

configuration = Configuration()
configuration.unstable_operations["delete_incident"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    api_instance.delete_incident(
        incident_id=INCIDENT_DATA_ID,
    )

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete an existing incident returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.delete_incident".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]
api_instance.delete_incident(INCIDENT_DATA_ID)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete an existing incident returns "OK" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.DeleteIncident", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	r, err := api.DeleteIncident(ctx, IncidentDataID)

	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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete an existing incident returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.deleteIncident", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    try {
      apiInstance.deleteIncident(INCIDENT_DATA_ID);
    } 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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Delete an existing incident returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.deleteIncident"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

const params: v2.IncidentsApiDeleteIncidentRequest = {
  incidentId: INCIDENT_DATA_ID,
};

apiInstance
  .deleteIncident(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

GET https://api.ap1.datadoghq.com/api/v2/incidentshttps://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/incidentshttps://api.us5.datadoghq.com/api/v2/incidents

개요

Get all incidents for the user’s organization. This endpoint requires the incident_read authorization scope.

인수

Query Strings

이름

유형

설명

include

array

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

page[size]

integer

Size for a given page. The maximum allowed value is 100.

page[offset]

integer

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

응답

OK

Response with a list of incidents.

Expand All

항목

유형

설명

data [required]

[object]

An array of incidents.

attributes

object

The incident's attributes from a response.

archived

date-time

Timestamp of when the incident was archived.

case_id

int64

The incident case id.

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>

 <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

default: dropdown

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

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

default: multiselect

value

[string]

The multiple values selected for this field.

modified

date-time

Timestamp when the incident was last modified.

non_datadog_creator

object

Incident's non Datadog creator.

image_48_px

string

Non Datadog creator 48px image.

name

string

Non Datadog creator name.

notification_handles

[object]

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

display_name

string

The name of the notified handle.

handle

string

The email address used for the notification.

public_id

int64

The monotonically increasing integer ID for the incident.

resolved

date-time

Timestamp when the incident's state was last changed from active or stable to resolved or completed.

severity

enum

The incident severity. Allowed enum values: UNKNOWN,SEV-1,SEV-2,SEV-3,SEV-4,SEV-5

state

string

The state incident.

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.

visibility

string

The incident visibility status.

id [required]

string

The incident's ID.

relationships

object

The incident's relationships from a response.

attachments

object

A relationship reference for attachments.

data [required]

[object]

An array of incident attachments.

id [required]

string

A unique identifier that represents the attachment.

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

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

default: 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

default: users

impacts

object

Relationship to impacts.

data [required]

[object]

An array of incident impacts.

id [required]

string

A unique identifier that represents the impact.

type [required]

enum

The incident impacts type. Allowed enum values: incident_impacts

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

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_integrations

default: incident_integrations

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

default: users

responders

object

Relationship to incident responders.

data [required]

[object]

An array of incident responders.

id [required]

string

A unique identifier that represents the responder.

type [required]

enum

The incident responders type. Allowed enum values: incident_responders

user_defined_fields

object

Relationship to incident user defined fields.

data [required]

[object]

An array of user defined fields.

id [required]

string

A unique identifier that represents the responder.

type [required]

enum

The incident user defined fields type. Allowed enum values: user_defined_field

type [required]

enum

Incident resource type. Allowed enum values: incidents

default: incidents

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

Option 2

object

A single incident attachment.

attributes [required]

 <oneOf>

The attributes object for an attachment.

Option 1

object

The attributes object for a postmortem attachment.

attachment [required]

object

The postmortem attachment.

documentUrl [required]

string

The URL of this notebook attachment.

title [required]

string

The title of this postmortem attachment.

attachment_type [required]

enum

The type of postmortem attachment attributes. Allowed enum values: postmortem

default: postmortem

Option 2

object

The attributes object for a link attachment.

attachment [required]

object

The link attachment.

documentUrl [required]

string

The URL of this link attachment.

title [required]

string

The title of this link attachment.

attachment_type [required]

enum

The type of link attachment attributes. Allowed enum values: link

default: link

modified

date-time

Timestamp when the incident attachment link was last modified.

id [required]

string

A unique identifier that represents the incident attachment.

relationships [required]

object

The incident attachment's relationships.

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

default: users

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

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": {
        "archived": "2019-09-19T10:00:00.000Z",
        "case_id": "integer",
        "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>": "undefined"
        },
        "modified": "2019-09-19T10:00:00.000Z",
        "non_datadog_creator": {
          "image_48_px": "string",
          "name": "string"
        },
        "notification_handles": [
          {
            "display_name": "Jane Doe",
            "handle": "@test.user@test.com"
          }
        ],
        "public_id": 1,
        "resolved": "2019-09-19T10:00:00.000Z",
        "severity": "UNKNOWN",
        "state": "string",
        "time_to_detect": "integer",
        "time_to_internal_response": "integer",
        "time_to_repair": "integer",
        "time_to_resolve": "integer",
        "title": "A test incident title",
        "visibility": "string"
      },
      "id": "00000000-0000-0000-1234-000000000000",
      "relationships": {
        "attachments": {
          "data": [
            {
              "id": "00000000-0000-abcd-1000-000000000000",
              "type": "incident_attachments"
            }
          ]
        },
        "commander_user": {
          "data": {
            "id": "00000000-0000-0000-0000-000000000000",
            "type": "users"
          }
        },
        "created_by_user": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        },
        "impacts": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "incident_impacts"
            }
          ]
        },
        "integrations": {
          "data": [
            {
              "id": "00000000-abcd-0001-0000-000000000000",
              "type": "incident_integrations"
            }
          ]
        },
        "last_modified_by_user": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        },
        "responders": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "incident_responders"
            }
          ]
        },
        "user_defined_fields": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "user_defined_field"
            }
          ]
        }
      },
      "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-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

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a list of incidents returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

configuration = Configuration()
configuration.unstable_operations["list_incidents"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.list_incidents()

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a list of incidents returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.list_incidents".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new
p api_instance.list_incidents()

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a list of incidents returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.ListIncidents", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.ListIncidents(ctx, *datadogV2.NewListIncidentsOptionalParameters())

	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)
	}

	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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a list of incidents returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.listIncidents", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    try {
      IncidentsResponse result = apiInstance.listIncidents();
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get a list of incidents returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.listIncidents"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

apiInstance
  .listIncidents()
  .then((data: v2.IncidentsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

GET https://api.ap1.datadoghq.com/api/v2/incidents/searchhttps://api.datadoghq.eu/api/v2/incidents/searchhttps://api.ddog-gov.com/api/v2/incidents/searchhttps://api.datadoghq.com/api/v2/incidents/searchhttps://api.us3.datadoghq.com/api/v2/incidents/searchhttps://api.us5.datadoghq.com/api/v2/incidents/search

개요

Search for incidents matching a certain query. This endpoint requires the incident_read authorization scope.

인수

Query Strings

이름

유형

설명

include

enum

Specifies which types of related objects should be included in the response.
Allowed enum values: users, attachments

query [required]

string

Specifies which incidents should be returned. The query can contain any number of incident facets joined by ANDs, along with multiple values for each of those facets joined by ORs. For example: state:active AND severity:(SEV-2 OR SEV-1).

sort

enum

Specifies the order of returned incidents.
Allowed enum values: created, -created

page[size]

integer

Size for a given page. The maximum allowed value is 100.

page[offset]

integer

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

응답

OK

Response with incidents and facets.

Expand All

항목

유형

설명

data [required]

object

Data returned by an incident search.

attributes

object

Attributes returned by an incident search.

facets [required]

object

Facet data for incidents returned by a search query.

commander

[object]

Facet data for incident commander users.

count

int32

Count of the facet value appearing in search results.

email

string

Email of the user.

handle

string

Handle of the user.

name

string

Name of the user.

uuid

string

ID of the user.

created_by

[object]

Facet data for incident creator users.

count

int32

Count of the facet value appearing in search results.

email

string

Email of the user.

handle

string

Handle of the user.

name

string

Name of the user.

uuid

string

ID of the user.

fields

[object]

Facet data for incident property fields.

aggregates

object

Aggregate information for numeric incident data.

max

double

Maximum value of the numeric aggregates.

min

double

Minimum value of the numeric aggregates.

facets [required]

[object]

Facet data for the property field of an incident.

count

int32

Count of the facet value appearing in search results.

name

string

The facet value appearing in search results.

name [required]

string

Name of the incident property field.

impact

[object]

Facet data for incident impact attributes.

count

int32

Count of the facet value appearing in search results.

name

string

The facet value appearing in search results.

last_modified_by

[object]

Facet data for incident last modified by users.

count

int32

Count of the facet value appearing in search results.

email

string

Email of the user.

handle

string

Handle of the user.

name

string

Name of the user.

uuid

string

ID of the user.

postmortem

[object]

Facet data for incident postmortem existence.

count

int32

Count of the facet value appearing in search results.

name

string

The facet value appearing in search results.

responder

[object]

Facet data for incident responder users.

count

int32

Count of the facet value appearing in search results.

email

string

Email of the user.

handle

string

Handle of the user.

name

string

Name of the user.

uuid

string

ID of the user.

severity

[object]

Facet data for incident severity attributes.

count

int32

Count of the facet value appearing in search results.

name

string

The facet value appearing in search results.

state

[object]

Facet data for incident state attributes.

count

int32

Count of the facet value appearing in search results.

name

string

The facet value appearing in search results.

time_to_repair

[object]

Facet data for incident time to repair metrics.

aggregates [required]

object

Aggregate information for numeric incident data.

max

double

Maximum value of the numeric aggregates.

min

double

Minimum value of the numeric aggregates.

name [required]

string

Name of the incident property field.

time_to_resolve

[object]

Facet data for incident time to resolve metrics.

aggregates [required]

object

Aggregate information for numeric incident data.

max

double

Maximum value of the numeric aggregates.

min

double

Minimum value of the numeric aggregates.

name [required]

string

Name of the incident property field.

incidents [required]

[object]

Incidents returned by the search.

data [required]

object

Incident data from a response.

attributes

object

The incident's attributes from a response.

archived

date-time

Timestamp of when the incident was archived.

case_id

int64

The incident case id.

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>

 <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

default: dropdown

value

string

The single value selected for this field.

Option 2

object

A field with potentially multiple values selected.

type

enum

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

default: multiselect

value

[string]

The multiple values selected for this field.

modified

date-time

Timestamp when the incident was last modified.

non_datadog_creator

object

Incident's non Datadog creator.

image_48_px

string

Non Datadog creator 48px image.

name

string

Non Datadog creator name.

notification_handles

[object]

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

display_name

string

The name of the notified handle.

handle

string

The email address used for the notification.

public_id

int64

The monotonically increasing integer ID for the incident.

resolved

date-time

Timestamp when the incident's state was last changed from active or stable to resolved or completed.

severity

enum

The incident severity. Allowed enum values: UNKNOWN,SEV-1,SEV-2,SEV-3,SEV-4,SEV-5

state

string

The state incident.

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.

visibility

string

The incident visibility status.

id [required]

string

The incident's ID.

relationships

object

The incident's relationships from a response.

attachments

object

A relationship reference for attachments.

data [required]

[object]

An array of incident attachments.

id [required]

string

A unique identifier that represents the attachment.

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

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

default: 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

default: users

impacts

object

Relationship to impacts.

data [required]

[object]

An array of incident impacts.

id [required]

string

A unique identifier that represents the impact.

type [required]

enum

The incident impacts type. Allowed enum values: incident_impacts

integrations

object

A relationship reference for multiple integration metadata objects.

data [required]

[object]

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_integrations

default: incident_integrations

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

default: users

responders

object

Relationship to incident responders.

data [required]

[object]

An array of incident responders.

id [required]

string

A unique identifier that represents the responder.

type [required]

enum

The incident responders type. Allowed enum values: incident_responders

user_defined_fields

object

Relationship to incident user defined fields.

data [required]

[object]

An array of user defined fields.

id [required]

string

A unique identifier that represents the responder.

type [required]

enum

The incident user defined fields type. Allowed enum values: user_defined_field

type [required]

enum

Incident resource type. Allowed enum values: incidents

default: incidents

total [required]

int32

Number of incidents returned by the search.

type

enum

Incident search result type. Allowed enum values: incidents_search_results

default: incidents_search_results

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

Option 2

object

A single incident attachment.

attributes [required]

 <oneOf>

The attributes object for an attachment.

Option 1

object

The attributes object for a postmortem attachment.

attachment [required]

object

The postmortem attachment.

documentUrl [required]

string

The URL of this notebook attachment.

title [required]

string

The title of this postmortem attachment.

attachment_type [required]

enum

The type of postmortem attachment attributes. Allowed enum values: postmortem

default: postmortem

Option 2

object

The attributes object for a link attachment.

attachment [required]

object

The link attachment.

documentUrl [required]

string

The URL of this link attachment.

title [required]

string

The title of this link attachment.

attachment_type [required]

enum

The type of link attachment attributes. Allowed enum values: link

default: link

modified

date-time

Timestamp when the incident attachment link was last modified.

id [required]

string

A unique identifier that represents the incident attachment.

relationships [required]

object

The incident attachment's relationships.

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

default: users

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

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": {
      "facets": {
        "commander": [
          {
            "count": 5,
            "email": "datadog.user@example.com",
            "handle": "@datadog.user@example.com",
            "name": "Datadog User",
            "uuid": "773b045d-ccf8-4808-bd3b-955ef6a8c940"
          }
        ],
        "created_by": [
          {
            "count": 5,
            "email": "datadog.user@example.com",
            "handle": "@datadog.user@example.com",
            "name": "Datadog User",
            "uuid": "773b045d-ccf8-4808-bd3b-955ef6a8c940"
          }
        ],
        "fields": [
          {
            "aggregates": {
              "max": 1234,
              "min": 20
            },
            "facets": [
              {
                "count": 5,
                "name": "SEV-2"
              }
            ],
            "name": "Severity"
          }
        ],
        "impact": [
          {
            "count": 5,
            "name": "SEV-2"
          }
        ],
        "last_modified_by": [
          {
            "count": 5,
            "email": "datadog.user@example.com",
            "handle": "@datadog.user@example.com",
            "name": "Datadog User",
            "uuid": "773b045d-ccf8-4808-bd3b-955ef6a8c940"
          }
        ],
        "postmortem": [
          {
            "count": 5,
            "name": "SEV-2"
          }
        ],
        "responder": [
          {
            "count": 5,
            "email": "datadog.user@example.com",
            "handle": "@datadog.user@example.com",
            "name": "Datadog User",
            "uuid": "773b045d-ccf8-4808-bd3b-955ef6a8c940"
          }
        ],
        "severity": [
          {
            "count": 5,
            "name": "SEV-2"
          }
        ],
        "state": [
          {
            "count": 5,
            "name": "SEV-2"
          }
        ],
        "time_to_repair": [
          {
            "aggregates": {
              "max": 1234,
              "min": 20
            },
            "name": "time_to_repair"
          }
        ],
        "time_to_resolve": [
          {
            "aggregates": {
              "max": 1234,
              "min": 20
            },
            "name": "time_to_repair"
          }
        ]
      },
      "incidents": [
        {
          "data": {
            "attributes": {
              "archived": "2019-09-19T10:00:00.000Z",
              "case_id": "integer",
              "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>": "undefined"
              },
              "modified": "2019-09-19T10:00:00.000Z",
              "non_datadog_creator": {
                "image_48_px": "string",
                "name": "string"
              },
              "notification_handles": [
                {
                  "display_name": "Jane Doe",
                  "handle": "@test.user@test.com"
                }
              ],
              "public_id": 1,
              "resolved": "2019-09-19T10:00:00.000Z",
              "severity": "UNKNOWN",
              "state": "string",
              "time_to_detect": "integer",
              "time_to_internal_response": "integer",
              "time_to_repair": "integer",
              "time_to_resolve": "integer",
              "title": "A test incident title",
              "visibility": "string"
            },
            "id": "00000000-0000-0000-1234-000000000000",
            "relationships": {
              "attachments": {
                "data": [
                  {
                    "id": "00000000-0000-abcd-1000-000000000000",
                    "type": "incident_attachments"
                  }
                ]
              },
              "commander_user": {
                "data": {
                  "id": "00000000-0000-0000-0000-000000000000",
                  "type": "users"
                }
              },
              "created_by_user": {
                "data": {
                  "id": "00000000-0000-0000-2345-000000000000",
                  "type": "users"
                }
              },
              "impacts": {
                "data": [
                  {
                    "id": "00000000-0000-0000-2345-000000000000",
                    "type": "incident_impacts"
                  }
                ]
              },
              "integrations": {
                "data": [
                  {
                    "id": "00000000-abcd-0001-0000-000000000000",
                    "type": "incident_integrations"
                  }
                ]
              },
              "last_modified_by_user": {
                "data": {
                  "id": "00000000-0000-0000-2345-000000000000",
                  "type": "users"
                }
              },
              "responders": {
                "data": [
                  {
                    "id": "00000000-0000-0000-2345-000000000000",
                    "type": "incident_responders"
                  }
                ]
              },
              "user_defined_fields": {
                "data": [
                  {
                    "id": "00000000-0000-0000-2345-000000000000",
                    "type": "user_defined_field"
                  }
                ]
              }
            },
            "type": "incidents"
          }
        }
      ],
      "total": 10
    },
    "type": "incidents_search_results"
  },
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-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

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Required query arguments
export query="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/search?query=${query}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Search for incidents returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

configuration = Configuration()
configuration.unstable_operations["search_incidents"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.search_incidents(
        query="state:(active OR stable OR resolved)",
    )

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Search for incidents returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.search_incidents".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new
p api_instance.search_incidents("state:(active OR stable OR resolved)")

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Search for incidents returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.SearchIncidents", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.SearchIncidents(ctx, "state:(active OR stable OR resolved)", *datadogV2.NewSearchIncidentsOptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.SearchIncidents`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.SearchIncidents`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Search for incidents returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentSearchResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.searchIncidents", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    try {
      IncidentSearchResponse result =
          apiInstance.searchIncidents("state:(active OR stable OR resolved)");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#searchIncidents");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Search for incidents returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.searchIncidents"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

const params: v2.IncidentsApiSearchIncidentsRequest = {
  query: "state:(active OR stable OR resolved)",
};

apiInstance
  .searchIncidents(params)
  .then((data: v2.IncidentSearchResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

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

개요

Get all attachments for a given incident. This endpoint requires the incident_read authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

Query Strings

이름

유형

설명

include

array

Specifies which types of related objects are included in the response.

filter[attachment_type]

array

Specifies which types of attachments are included in the response.

응답

OK

The response object containing an incident’s attachments.

Expand All

항목

유형

설명

data [required]

[object]

An array of incident attachments.

attributes [required]

 <oneOf>

The attributes object for an attachment.

Option 1

object

The attributes object for a postmortem attachment.

attachment [required]

object

The postmortem attachment.

documentUrl [required]

string

The URL of this notebook attachment.

title [required]

string

The title of this postmortem attachment.

attachment_type [required]

enum

The type of postmortem attachment attributes. Allowed enum values: postmortem

default: postmortem

Option 2

object

The attributes object for a link attachment.

attachment [required]

object

The link attachment.

documentUrl [required]

string

The URL of this link attachment.

title [required]

string

The title of this link attachment.

attachment_type [required]

enum

The type of link attachment attributes. Allowed enum values: link

default: link

modified

date-time

Timestamp when the incident attachment link was last modified.

id [required]

string

A unique identifier that represents the incident attachment.

relationships [required]

object

The incident attachment's relationships.

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

default: users

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

{
  "data": [
    {
      "attributes": {
        "attachment": {
          "documentUrl": "https://app.datadoghq.com/notebook/123",
          "title": "Postmortem IR-123"
        },
        "attachment_type": "postmortem"
      },
      "id": "00000000-abcd-0001-0000-000000000000",
      "relationships": {
        "last_modified_by_user": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        }
      },
      "type": "incident_attachments"
    }
  ],
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/attachments" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a list of attachments returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

configuration = Configuration()
configuration.unstable_operations["list_incident_attachments"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.list_incident_attachments(
        incident_id="incident_id",
    )

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a list of attachments returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.list_incident_attachments".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new
p api_instance.list_incident_attachments("incident_id")

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a list of attachments returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.ListIncidentAttachments", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.ListIncidentAttachments(ctx, "incident_id", *datadogV2.NewListIncidentAttachmentsOptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.ListIncidentAttachments`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.ListIncidentAttachments`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a list of attachments returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentAttachmentsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.listIncidentAttachments", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    try {
      IncidentAttachmentsResponse result = apiInstance.listIncidentAttachments("incident_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#listIncidentAttachments");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get a list of attachments returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.listIncidentAttachments"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

const params: v2.IncidentsApiListIncidentAttachmentsRequest = {
  incidentId: "incident_id",
};

apiInstance
  .listIncidentAttachments(params)
  .then((data: v2.IncidentAttachmentsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

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

개요

The bulk update endpoint for creating, updating, and deleting attachments for a given incident.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

Query Strings

이름

유형

설명

include

array

Specifies which types of related objects are included in the response.

요청

Body Data (required)

Incident Attachment Payload.

Expand All

항목

유형

설명

data [required]

[object]

An array of incident attachments. An attachment object without an "id" key indicates that you want to create that attachment. An attachment object without an "attributes" key indicates that you want to delete that attachment. An attachment object with both the "id" key and a populated "attributes" object indicates that you want to update that attachment.

attributes

 <oneOf>

Incident attachment attributes.

Option 1

object

The attributes object for a postmortem attachment.

attachment [required]

object

The postmortem attachment.

documentUrl [required]

string

The URL of this notebook attachment.

title [required]

string

The title of this postmortem attachment.

attachment_type [required]

enum

The type of postmortem attachment attributes. Allowed enum values: postmortem

default: postmortem

Option 2

object

The attributes object for a link attachment.

attachment [required]

object

The link attachment.

documentUrl [required]

string

The URL of this link attachment.

title [required]

string

The title of this link attachment.

attachment_type [required]

enum

The type of link attachment attributes. Allowed enum values: link

default: link

modified

date-time

Timestamp when the incident attachment link was last modified.

id

string

A unique identifier that represents the incident attachment.

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

{
  "data": [
    {
      "type": "incident_attachments",
      "attributes": {
        "attachment_type": "link",
        "attachment": {
          "documentUrl": "https://www.example.com/doc",
          "title": "Example-Incident"
        }
      }
    }
  ]
}

응답

OK

The response object containing the created or updated incident attachments.

Expand All

항목

유형

설명

data [required]

[object]

An array of incident attachments. Only the attachments that were created or updated by the request are returned.

attributes [required]

 <oneOf>

The attributes object for an attachment.

Option 1

object

The attributes object for a postmortem attachment.

attachment [required]

object

The postmortem attachment.

documentUrl [required]

string

The URL of this notebook attachment.

title [required]

string

The title of this postmortem attachment.

attachment_type [required]

enum

The type of postmortem attachment attributes. Allowed enum values: postmortem

default: postmortem

Option 2

object

The attributes object for a link attachment.

attachment [required]

object

The link attachment.

documentUrl [required]

string

The URL of this link attachment.

title [required]

string

The title of this link attachment.

attachment_type [required]

enum

The type of link attachment attributes. Allowed enum values: link

default: link

modified

date-time

Timestamp when the incident attachment link was last modified.

id [required]

string

A unique identifier that represents the incident attachment.

relationships [required]

object

The incident attachment's relationships.

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

default: users

type [required]

enum

The incident attachment resource type. Allowed enum values: incident_attachments

default: incident_attachments

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

{
  "data": [
    {
      "attributes": {
        "attachment": {
          "documentUrl": "https://app.datadoghq.com/notebook/123",
          "title": "Postmortem IR-123"
        },
        "attachment_type": "postmortem"
      },
      "id": "00000000-abcd-0001-0000-000000000000",
      "relationships": {
        "last_modified_by_user": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        }
      },
      "type": "incident_attachments"
    }
  ],
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                          # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/attachments" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": [ { "type": "incident_attachments", "attributes": { "attachment_type": "link", "attachment": { "documentUrl": "https://www.example.com/doc", "title": "Example-Incident" } } } ] } EOF
// Create an incident attachment returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	body := datadogV2.IncidentAttachmentUpdateRequest{
		Data: []datadogV2.IncidentAttachmentUpdateData{
			{
				Type: datadogV2.INCIDENTATTACHMENTTYPE_INCIDENT_ATTACHMENTS,
				Attributes: &datadogV2.IncidentAttachmentUpdateAttributes{
					IncidentAttachmentLinkAttributes: &datadogV2.IncidentAttachmentLinkAttributes{
						AttachmentType: datadogV2.INCIDENTATTACHMENTLINKATTACHMENTTYPE_LINK,
						Attachment: datadogV2.IncidentAttachmentLinkAttributesAttachmentObject{
							DocumentUrl: "https://www.example.com/doc",
							Title:       "Example-Incident",
						},
					}},
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.UpdateIncidentAttachments", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.UpdateIncidentAttachments(ctx, IncidentDataID, body, *datadogV2.NewUpdateIncidentAttachmentsOptionalParameters())

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.UpdateIncidentAttachments`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.UpdateIncidentAttachments`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Create an incident attachment returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentAttachmentLinkAttachmentType;
import com.datadog.api.client.v2.model.IncidentAttachmentLinkAttributes;
import com.datadog.api.client.v2.model.IncidentAttachmentLinkAttributesAttachmentObject;
import com.datadog.api.client.v2.model.IncidentAttachmentType;
import com.datadog.api.client.v2.model.IncidentAttachmentUpdateAttributes;
import com.datadog.api.client.v2.model.IncidentAttachmentUpdateData;
import com.datadog.api.client.v2.model.IncidentAttachmentUpdateRequest;
import com.datadog.api.client.v2.model.IncidentAttachmentUpdateResponse;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.updateIncidentAttachments", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    IncidentAttachmentUpdateRequest body =
        new IncidentAttachmentUpdateRequest()
            .data(
                Collections.singletonList(
                    new IncidentAttachmentUpdateData()
                        .type(IncidentAttachmentType.INCIDENT_ATTACHMENTS)
                        .attributes(
                            new IncidentAttachmentUpdateAttributes(
                                new IncidentAttachmentLinkAttributes()
                                    .attachmentType(IncidentAttachmentLinkAttachmentType.LINK)
                                    .attachment(
                                        new IncidentAttachmentLinkAttributesAttachmentObject()
                                            .documentUrl("https://www.example.com/doc")
                                            .title("Example-Incident"))))));

    try {
      IncidentAttachmentUpdateResponse result =
          apiInstance.updateIncidentAttachments(INCIDENT_DATA_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#updateIncidentAttachments");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
"""
Create an incident attachment returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_attachment_link_attachment_type import IncidentAttachmentLinkAttachmentType
from datadog_api_client.v2.model.incident_attachment_link_attributes import IncidentAttachmentLinkAttributes
from datadog_api_client.v2.model.incident_attachment_link_attributes_attachment_object import (
    IncidentAttachmentLinkAttributesAttachmentObject,
)
from datadog_api_client.v2.model.incident_attachment_type import IncidentAttachmentType
from datadog_api_client.v2.model.incident_attachment_update_data import IncidentAttachmentUpdateData
from datadog_api_client.v2.model.incident_attachment_update_request import IncidentAttachmentUpdateRequest

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

body = IncidentAttachmentUpdateRequest(
    data=[
        IncidentAttachmentUpdateData(
            type=IncidentAttachmentType.INCIDENT_ATTACHMENTS,
            attributes=IncidentAttachmentLinkAttributes(
                attachment_type=IncidentAttachmentLinkAttachmentType.LINK,
                attachment=IncidentAttachmentLinkAttributesAttachmentObject(
                    document_url="https://www.example.com/doc",
                    title="Example-Incident",
                ),
            ),
        ),
    ],
)

configuration = Configuration()
configuration.unstable_operations["update_incident_attachments"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.update_incident_attachments(incident_id=INCIDENT_DATA_ID, body=body)

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Create an incident attachment returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.update_incident_attachments".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

body = DatadogAPIClient::V2::IncidentAttachmentUpdateRequest.new({
  data: [
    DatadogAPIClient::V2::IncidentAttachmentUpdateData.new({
      type: DatadogAPIClient::V2::IncidentAttachmentType::INCIDENT_ATTACHMENTS,
      attributes: DatadogAPIClient::V2::IncidentAttachmentLinkAttributes.new({
        attachment_type: DatadogAPIClient::V2::IncidentAttachmentLinkAttachmentType::LINK,
        attachment: DatadogAPIClient::V2::IncidentAttachmentLinkAttributesAttachmentObject.new({
          document_url: "https://www.example.com/doc",
          title: "Example-Incident",
        }),
      }),
    }),
  ],
})
p api_instance.update_incident_attachments(INCIDENT_DATA_ID, body)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
/**
 * Create an incident attachment returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.updateIncidentAttachments"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

const params: v2.IncidentsApiUpdateIncidentAttachmentsRequest = {
  body: {
    data: [
      {
        type: "incident_attachments",
        attributes: {
          attachmentType: "link",
          attachment: {
            documentUrl: "https://www.example.com/doc",
            title: "Example-Incident",
          },
        },
      },
    ],
  },
  incidentId: INCIDENT_DATA_ID,
};

apiInstance
  .updateIncidentAttachments(params)
  .then((data: v2.IncidentAttachmentUpdateResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"

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

GET https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrationshttps://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/integrationshttps://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/integrationshttps://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrationshttps://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrationshttps://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations

개요

Get all integration metadata for an incident. This endpoint requires the incident_read authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

응답

OK

Response with a list of incident integration metadata.

Expand All

항목

유형

설명

data [required]

[object]

An array of incident integration metadata.

attributes

object

Incident integration metadata's attributes for a create request.

created

date-time

Timestamp when the incident todo was created.

incident_id

string

UUID of the incident this integration metadata is connected to.

integration_type [required]

int32

A number indicating the type of integration this metadata is for. 1 indicates Slack; 8 indicates Jira.

metadata [required]

 <oneOf>

Incident integration metadata's metadata attribute.

Option 1

object

Incident integration metadata for the Slack integration.

channels [required]

[object]

Array of Slack channels in this integration metadata.

channel_id [required]

string

Slack channel ID.

channel_name [required]

string

Name of the Slack channel.

redirect_url [required]

string

URL redirecting to the Slack channel.

team_id

string

Slack team ID.

Option 2

object

Incident integration metadata for the Jira integration.

issues [required]

[object]

Array of Jira issues in this integration metadata.

account [required]

string

URL of issue's Jira account.

issue_key

string

Jira issue's issue key.

issuetype_id

string

Jira issue's issue type.

project_key [required]

string

Jira issue's project keys.

redirect_url

string

URL redirecting to the Jira issue.

modified

date-time

Timestamp when the incident todo was last modified.

status

int32

A number indicating the status of this integration metadata. 0 indicates unknown; 1 indicates pending; 2 indicates complete; 3 indicates manually created; 4 indicates manually updated; 5 indicates failed.

id [required]

string

The incident integration metadata's ID.

relationships

object

The incident's integration relationships from a response.

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

default: users

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

default: users

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integrations

default: incident_integrations

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: 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",
        "incident_id": "00000000-aaaa-0000-0000-000000000000",
        "integration_type": 1,
        "metadata": {
          "channels": [
            {
              "channel_id": "C0123456789",
              "channel_name": "#example-channel-name",
              "redirect_url": "https://slack.com/app_redirect?channel=C0123456789\u0026team=T01234567",
              "team_id": "T01234567"
            }
          ]
        },
        "modified": "2019-09-19T10:00:00.000Z",
        "status": "integer"
      },
      "id": "00000000-0000-0000-1234-000000000000",
      "relationships": {
        "created_by_user": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        },
        "last_modified_by_user": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        }
      },
      "type": "incident_integrations"
    }
  ],
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-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

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/relationships/integrations" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a list of an incident's integration metadata returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

configuration = Configuration()
configuration.unstable_operations["list_incident_integrations"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.list_incident_integrations(
        incident_id=INCIDENT_DATA_ID,
    )

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a list of an incident's integration metadata returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.list_incident_integrations".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]
p api_instance.list_incident_integrations(INCIDENT_DATA_ID)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a list of an incident's integration metadata returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.ListIncidentIntegrations", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.ListIncidentIntegrations(ctx, IncidentDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.ListIncidentIntegrations`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.ListIncidentIntegrations`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a list of an incident's integration metadata returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataListResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.listIncidentIntegrations", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    try {
      IncidentIntegrationMetadataListResponse result =
          apiInstance.listIncidentIntegrations(INCIDENT_DATA_ID);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#listIncidentIntegrations");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get a list of an incident's integration metadata returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.listIncidentIntegrations"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

const params: v2.IncidentsApiListIncidentIntegrationsRequest = {
  incidentId: INCIDENT_DATA_ID,
};

apiInstance
  .listIncidentIntegrations(params)
  .then((data: v2.IncidentIntegrationMetadataListResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

POST https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrationshttps://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/integrationshttps://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/integrationshttps://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrationshttps://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrationshttps://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations

개요

Create an incident integration metadata. This endpoint requires the incident_write authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

요청

Body Data (required)

Incident integration metadata payload.

Expand All

항목

유형

설명

data [required]

object

Incident integration metadata data for a create request.

attributes [required]

object

Incident integration metadata's attributes for a create request.

created

date-time

Timestamp when the incident todo was created.

incident_id

string

UUID of the incident this integration metadata is connected to.

integration_type [required]

int32

A number indicating the type of integration this metadata is for. 1 indicates Slack; 8 indicates Jira.

metadata [required]

 <oneOf>

Incident integration metadata's metadata attribute.

Option 1

object

Incident integration metadata for the Slack integration.

channels [required]

[object]

Array of Slack channels in this integration metadata.

channel_id [required]

string

Slack channel ID.

channel_name [required]

string

Name of the Slack channel.

redirect_url [required]

string

URL redirecting to the Slack channel.

team_id

string

Slack team ID.

Option 2

object

Incident integration metadata for the Jira integration.

issues [required]

[object]

Array of Jira issues in this integration metadata.

account [required]

string

URL of issue's Jira account.

issue_key

string

Jira issue's issue key.

issuetype_id

string

Jira issue's issue type.

project_key [required]

string

Jira issue's project keys.

redirect_url

string

URL redirecting to the Jira issue.

modified

date-time

Timestamp when the incident todo was last modified.

status

int32

A number indicating the status of this integration metadata. 0 indicates unknown; 1 indicates pending; 2 indicates complete; 3 indicates manually created; 4 indicates manually updated; 5 indicates failed.

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integrations

default: incident_integrations

{
  "data": {
    "attributes": {
      "incident_id": "00000000-0000-0000-1234-000000000000",
      "integration_type": 1,
      "metadata": {
        "channels": [
          {
            "channel_id": "C0123456789",
            "channel_name": "#new-channel",
            "team_id": "T01234567",
            "redirect_url": "https://slack.com/app_redirect?channel=C0123456789&team=T01234567"
          }
        ]
      }
    },
    "type": "incident_integrations"
  }
}

응답

CREATED

Response with an incident integration metadata.

Expand All

항목

유형

설명

data [required]

object

Incident integration metadata from a response.

attributes

object

Incident integration metadata's attributes for a create request.

created

date-time

Timestamp when the incident todo was created.

incident_id

string

UUID of the incident this integration metadata is connected to.

integration_type [required]

int32

A number indicating the type of integration this metadata is for. 1 indicates Slack; 8 indicates Jira.

metadata [required]

 <oneOf>

Incident integration metadata's metadata attribute.

Option 1

object

Incident integration metadata for the Slack integration.

channels [required]

[object]

Array of Slack channels in this integration metadata.

channel_id [required]

string

Slack channel ID.

channel_name [required]

string

Name of the Slack channel.

redirect_url [required]

string

URL redirecting to the Slack channel.

team_id

string

Slack team ID.

Option 2

object

Incident integration metadata for the Jira integration.

issues [required]

[object]

Array of Jira issues in this integration metadata.

account [required]

string

URL of issue's Jira account.

issue_key

string

Jira issue's issue key.

issuetype_id

string

Jira issue's issue type.

project_key [required]

string

Jira issue's project keys.

redirect_url

string

URL redirecting to the Jira issue.

modified

date-time

Timestamp when the incident todo was last modified.

status

int32

A number indicating the status of this integration metadata. 0 indicates unknown; 1 indicates pending; 2 indicates complete; 3 indicates manually created; 4 indicates manually updated; 5 indicates failed.

id [required]

string

The incident integration metadata's ID.

relationships

object

The incident's integration relationships from a response.

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

default: users

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

default: users

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integrations

default: incident_integrations

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

{
  "data": {
    "attributes": {
      "created": "2019-09-19T10:00:00.000Z",
      "incident_id": "00000000-aaaa-0000-0000-000000000000",
      "integration_type": 1,
      "metadata": {
        "channels": [
          {
            "channel_id": "C0123456789",
            "channel_name": "#example-channel-name",
            "redirect_url": "https://slack.com/app_redirect?channel=C0123456789\u0026team=T01234567",
            "team_id": "T01234567"
          }
        ]
      },
      "modified": "2019-09-19T10:00:00.000Z",
      "status": "integer"
    },
    "id": "00000000-0000-0000-1234-000000000000",
    "relationships": {
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      }
    },
    "type": "incident_integrations"
  },
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                          # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/relationships/integrations" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "incident_id": "00000000-0000-0000-1234-000000000000", "integration_type": 1, "metadata": { "channels": [ { "channel_id": "C0123456789", "channel_name": "#new-channel", "team_id": "T01234567", "redirect_url": "https://slack.com/app_redirect?channel=C0123456789&team=T01234567" } ] } }, "type": "incident_integrations" } } EOF
// Create an incident integration metadata returns "CREATED" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	body := datadogV2.IncidentIntegrationMetadataCreateRequest{
		Data: datadogV2.IncidentIntegrationMetadataCreateData{
			Attributes: datadogV2.IncidentIntegrationMetadataAttributes{
				IncidentId:      datadog.PtrString(IncidentDataID),
				IntegrationType: 1,
				Metadata: datadogV2.IncidentIntegrationMetadataMetadata{
					SlackIntegrationMetadata: &datadogV2.SlackIntegrationMetadata{
						Channels: []datadogV2.SlackIntegrationMetadataChannelItem{
							{
								ChannelId:   "C0123456789",
								ChannelName: "#new-channel",
								TeamId:      datadog.PtrString("T01234567"),
								RedirectUrl: "https://slack.com/app_redirect?channel=C0123456789&team=T01234567",
							},
						},
					}},
			},
			Type: datadogV2.INCIDENTINTEGRATIONMETADATATYPE_INCIDENT_INTEGRATIONS,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.CreateIncidentIntegration", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.CreateIncidentIntegration(ctx, IncidentDataID, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.CreateIncidentIntegration`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.CreateIncidentIntegration`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create an incident integration metadata returns "CREATED" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataAttributes;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataCreateData;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataCreateRequest;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataMetadata;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataResponse;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataType;
import com.datadog.api.client.v2.model.SlackIntegrationMetadata;
import com.datadog.api.client.v2.model.SlackIntegrationMetadataChannelItem;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.createIncidentIntegration", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    IncidentIntegrationMetadataCreateRequest body =
        new IncidentIntegrationMetadataCreateRequest()
            .data(
                new IncidentIntegrationMetadataCreateData()
                    .attributes(
                        new IncidentIntegrationMetadataAttributes()
                            .incidentId(INCIDENT_DATA_ID)
                            .integrationType(1)
                            .metadata(
                                new IncidentIntegrationMetadataMetadata(
                                    new SlackIntegrationMetadata()
                                        .channels(
                                            Collections.singletonList(
                                                new SlackIntegrationMetadataChannelItem()
                                                    .channelId("C0123456789")
                                                    .channelName("#new-channel")
                                                    .teamId("T01234567")
                                                    .redirectUrl(
                                                        "https://slack.com/app_redirect?channel=C0123456789&team=T01234567"))))))
                    .type(IncidentIntegrationMetadataType.INCIDENT_INTEGRATIONS));

    try {
      IncidentIntegrationMetadataResponse result =
          apiInstance.createIncidentIntegration(INCIDENT_DATA_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#createIncidentIntegration");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create an incident integration metadata returns "CREATED" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_integration_metadata_attributes import IncidentIntegrationMetadataAttributes
from datadog_api_client.v2.model.incident_integration_metadata_create_data import IncidentIntegrationMetadataCreateData
from datadog_api_client.v2.model.incident_integration_metadata_create_request import (
    IncidentIntegrationMetadataCreateRequest,
)
from datadog_api_client.v2.model.incident_integration_metadata_type import IncidentIntegrationMetadataType
from datadog_api_client.v2.model.slack_integration_metadata import SlackIntegrationMetadata
from datadog_api_client.v2.model.slack_integration_metadata_channel_item import SlackIntegrationMetadataChannelItem

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

body = IncidentIntegrationMetadataCreateRequest(
    data=IncidentIntegrationMetadataCreateData(
        attributes=IncidentIntegrationMetadataAttributes(
            incident_id=INCIDENT_DATA_ID,
            integration_type=1,
            metadata=SlackIntegrationMetadata(
                channels=[
                    SlackIntegrationMetadataChannelItem(
                        channel_id="C0123456789",
                        channel_name="#new-channel",
                        team_id="T01234567",
                        redirect_url="https://slack.com/app_redirect?channel=C0123456789&team=T01234567",
                    ),
                ],
            ),
        ),
        type=IncidentIntegrationMetadataType.INCIDENT_INTEGRATIONS,
    ),
)

configuration = Configuration()
configuration.unstable_operations["create_incident_integration"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.create_incident_integration(incident_id=INCIDENT_DATA_ID, body=body)

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create an incident integration metadata returns "CREATED" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.create_incident_integration".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

body = DatadogAPIClient::V2::IncidentIntegrationMetadataCreateRequest.new({
  data: DatadogAPIClient::V2::IncidentIntegrationMetadataCreateData.new({
    attributes: DatadogAPIClient::V2::IncidentIntegrationMetadataAttributes.new({
      incident_id: INCIDENT_DATA_ID,
      integration_type: 1,
      metadata: DatadogAPIClient::V2::SlackIntegrationMetadata.new({
        channels: [
          DatadogAPIClient::V2::SlackIntegrationMetadataChannelItem.new({
            channel_id: "C0123456789",
            channel_name: "#new-channel",
            team_id: "T01234567",
            redirect_url: "https://slack.com/app_redirect?channel=C0123456789&team=T01234567",
          }),
        ],
      }),
    }),
    type: DatadogAPIClient::V2::IncidentIntegrationMetadataType::INCIDENT_INTEGRATIONS,
  }),
})
p api_instance.create_incident_integration(INCIDENT_DATA_ID, body)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Create an incident integration metadata returns "CREATED" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.createIncidentIntegration"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

const params: v2.IncidentsApiCreateIncidentIntegrationRequest = {
  body: {
    data: {
      attributes: {
        incidentId: INCIDENT_DATA_ID,
        integrationType: 1,
        metadata: {
          channels: [
            {
              channelId: "C0123456789",
              channelName: "#new-channel",
              teamId: "T01234567",
              redirectUrl:
                "https://slack.com/app_redirect?channel=C0123456789&team=T01234567",
            },
          ],
        },
      },
      type: "incident_integrations",
    },
  },
  incidentId: INCIDENT_DATA_ID,
};

apiInstance
  .createIncidentIntegration(params)
  .then((data: v2.IncidentIntegrationMetadataResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

GET https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}

개요

Get incident integration metadata details. This endpoint requires the incident_read authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

integration_metadata_id [required]

string

The UUID of the incident integration metadata.

응답

OK

Response with an incident integration metadata.

Expand All

항목

유형

설명

data [required]

object

Incident integration metadata from a response.

attributes

object

Incident integration metadata's attributes for a create request.

created

date-time

Timestamp when the incident todo was created.

incident_id

string

UUID of the incident this integration metadata is connected to.

integration_type [required]

int32

A number indicating the type of integration this metadata is for. 1 indicates Slack; 8 indicates Jira.

metadata [required]

 <oneOf>

Incident integration metadata's metadata attribute.

Option 1

object

Incident integration metadata for the Slack integration.

channels [required]

[object]

Array of Slack channels in this integration metadata.

channel_id [required]

string

Slack channel ID.

channel_name [required]

string

Name of the Slack channel.

redirect_url [required]

string

URL redirecting to the Slack channel.

team_id

string

Slack team ID.

Option 2

object

Incident integration metadata for the Jira integration.

issues [required]

[object]

Array of Jira issues in this integration metadata.

account [required]

string

URL of issue's Jira account.

issue_key

string

Jira issue's issue key.

issuetype_id

string

Jira issue's issue type.

project_key [required]

string

Jira issue's project keys.

redirect_url

string

URL redirecting to the Jira issue.

modified

date-time

Timestamp when the incident todo was last modified.

status

int32

A number indicating the status of this integration metadata. 0 indicates unknown; 1 indicates pending; 2 indicates complete; 3 indicates manually created; 4 indicates manually updated; 5 indicates failed.

id [required]

string

The incident integration metadata's ID.

relationships

object

The incident's integration relationships from a response.

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

default: users

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

default: users

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integrations

default: incident_integrations

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

{
  "data": {
    "attributes": {
      "created": "2019-09-19T10:00:00.000Z",
      "incident_id": "00000000-aaaa-0000-0000-000000000000",
      "integration_type": 1,
      "metadata": {
        "channels": [
          {
            "channel_id": "C0123456789",
            "channel_name": "#example-channel-name",
            "redirect_url": "https://slack.com/app_redirect?channel=C0123456789\u0026team=T01234567",
            "team_id": "T01234567"
          }
        ]
      },
      "modified": "2019-09-19T10:00:00.000Z",
      "status": "integer"
    },
    "id": "00000000-0000-0000-1234-000000000000",
    "relationships": {
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      }
    },
    "type": "incident_integrations"
  },
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Path parameters
export incident_id="CHANGE_ME"
export integration_metadata_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/relationships/integrations/${integration_metadata_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get incident integration metadata details returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

# the "incident" has an "incident_integration_metadata"
INCIDENT_INTEGRATION_METADATA_DATA_ID = environ["INCIDENT_INTEGRATION_METADATA_DATA_ID"]

configuration = Configuration()
configuration.unstable_operations["get_incident_integration"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.get_incident_integration(
        incident_id=INCIDENT_DATA_ID,
        integration_metadata_id=INCIDENT_INTEGRATION_METADATA_DATA_ID,
    )

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get incident integration metadata details returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.get_incident_integration".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

# the "incident" has an "incident_integration_metadata"
INCIDENT_INTEGRATION_METADATA_DATA_ID = ENV["INCIDENT_INTEGRATION_METADATA_DATA_ID"]
p api_instance.get_incident_integration(INCIDENT_DATA_ID, INCIDENT_INTEGRATION_METADATA_DATA_ID)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get incident integration metadata details returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	// the "incident" has an "incident_integration_metadata"
	IncidentIntegrationMetadataDataID := os.Getenv("INCIDENT_INTEGRATION_METADATA_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.GetIncidentIntegration", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.GetIncidentIntegration(ctx, IncidentDataID, IncidentIntegrationMetadataDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.GetIncidentIntegration`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.GetIncidentIntegration`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get incident integration metadata details returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.getIncidentIntegration", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    // the "incident" has an "incident_integration_metadata"
    String INCIDENT_INTEGRATION_METADATA_DATA_ID =
        System.getenv("INCIDENT_INTEGRATION_METADATA_DATA_ID");

    try {
      IncidentIntegrationMetadataResponse result =
          apiInstance.getIncidentIntegration(
              INCIDENT_DATA_ID, INCIDENT_INTEGRATION_METADATA_DATA_ID);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#getIncidentIntegration");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get incident integration metadata details returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.getIncidentIntegration"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

// the "incident" has an "incident_integration_metadata"
const INCIDENT_INTEGRATION_METADATA_DATA_ID = process.env
  .INCIDENT_INTEGRATION_METADATA_DATA_ID as string;

const params: v2.IncidentsApiGetIncidentIntegrationRequest = {
  incidentId: INCIDENT_DATA_ID,
  integrationMetadataId: INCIDENT_INTEGRATION_METADATA_DATA_ID,
};

apiInstance
  .getIncidentIntegration(params)
  .then((data: v2.IncidentIntegrationMetadataResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

PATCH https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}

개요

Update an existing incident integration metadata. This endpoint requires the incident_write authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

integration_metadata_id [required]

string

The UUID of the incident integration metadata.

요청

Body Data (required)

Incident integration metadata payload.

Expand All

항목

유형

설명

data [required]

object

Incident integration metadata data for a patch request.

attributes [required]

object

Incident integration metadata's attributes for a create request.

created

date-time

Timestamp when the incident todo was created.

incident_id

string

UUID of the incident this integration metadata is connected to.

integration_type [required]

int32

A number indicating the type of integration this metadata is for. 1 indicates Slack; 8 indicates Jira.

metadata [required]

 <oneOf>

Incident integration metadata's metadata attribute.

Option 1

object

Incident integration metadata for the Slack integration.

channels [required]

[object]

Array of Slack channels in this integration metadata.

channel_id [required]

string

Slack channel ID.

channel_name [required]

string

Name of the Slack channel.

redirect_url [required]

string

URL redirecting to the Slack channel.

team_id

string

Slack team ID.

Option 2

object

Incident integration metadata for the Jira integration.

issues [required]

[object]

Array of Jira issues in this integration metadata.

account [required]

string

URL of issue's Jira account.

issue_key

string

Jira issue's issue key.

issuetype_id

string

Jira issue's issue type.

project_key [required]

string

Jira issue's project keys.

redirect_url

string

URL redirecting to the Jira issue.

modified

date-time

Timestamp when the incident todo was last modified.

status

int32

A number indicating the status of this integration metadata. 0 indicates unknown; 1 indicates pending; 2 indicates complete; 3 indicates manually created; 4 indicates manually updated; 5 indicates failed.

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integrations

default: incident_integrations

{
  "data": {
    "attributes": {
      "incident_id": "00000000-0000-0000-1234-000000000000",
      "integration_type": 1,
      "metadata": {
        "channels": [
          {
            "channel_id": "C0123456789",
            "channel_name": "#updated-channel-name",
            "team_id": "T01234567",
            "redirect_url": "https://slack.com/app_redirect?channel=C0123456789&team=T01234567"
          }
        ]
      }
    },
    "type": "incident_integrations"
  }
}

응답

OK

Response with an incident integration metadata.

Expand All

항목

유형

설명

data [required]

object

Incident integration metadata from a response.

attributes

object

Incident integration metadata's attributes for a create request.

created

date-time

Timestamp when the incident todo was created.

incident_id

string

UUID of the incident this integration metadata is connected to.

integration_type [required]

int32

A number indicating the type of integration this metadata is for. 1 indicates Slack; 8 indicates Jira.

metadata [required]

 <oneOf>

Incident integration metadata's metadata attribute.

Option 1

object

Incident integration metadata for the Slack integration.

channels [required]

[object]

Array of Slack channels in this integration metadata.

channel_id [required]

string

Slack channel ID.

channel_name [required]

string

Name of the Slack channel.

redirect_url [required]

string

URL redirecting to the Slack channel.

team_id

string

Slack team ID.

Option 2

object

Incident integration metadata for the Jira integration.

issues [required]

[object]

Array of Jira issues in this integration metadata.

account [required]

string

URL of issue's Jira account.

issue_key

string

Jira issue's issue key.

issuetype_id

string

Jira issue's issue type.

project_key [required]

string

Jira issue's project keys.

redirect_url

string

URL redirecting to the Jira issue.

modified

date-time

Timestamp when the incident todo was last modified.

status

int32

A number indicating the status of this integration metadata. 0 indicates unknown; 1 indicates pending; 2 indicates complete; 3 indicates manually created; 4 indicates manually updated; 5 indicates failed.

id [required]

string

The incident integration metadata's ID.

relationships

object

The incident's integration relationships from a response.

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

default: users

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

default: users

type [required]

enum

Integration metadata resource type. Allowed enum values: incident_integrations

default: incident_integrations

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

{
  "data": {
    "attributes": {
      "created": "2019-09-19T10:00:00.000Z",
      "incident_id": "00000000-aaaa-0000-0000-000000000000",
      "integration_type": 1,
      "metadata": {
        "channels": [
          {
            "channel_id": "C0123456789",
            "channel_name": "#example-channel-name",
            "redirect_url": "https://slack.com/app_redirect?channel=C0123456789\u0026team=T01234567",
            "team_id": "T01234567"
          }
        ]
      },
      "modified": "2019-09-19T10:00:00.000Z",
      "status": "integer"
    },
    "id": "00000000-0000-0000-1234-000000000000",
    "relationships": {
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      }
    },
    "type": "incident_integrations"
  },
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                          # Path parameters
export incident_id="CHANGE_ME"
export integration_metadata_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/relationships/integrations/${integration_metadata_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "incident_id": "00000000-0000-0000-1234-000000000000", "integration_type": 1, "metadata": { "channels": [ { "channel_id": "C0123456789", "channel_name": "#updated-channel-name", "team_id": "T01234567", "redirect_url": "https://slack.com/app_redirect?channel=C0123456789&team=T01234567" } ] } }, "type": "incident_integrations" } } EOF
// Update an existing incident integration metadata returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	// the "incident" has an "incident_integration_metadata"
	IncidentIntegrationMetadataDataID := os.Getenv("INCIDENT_INTEGRATION_METADATA_DATA_ID")

	body := datadogV2.IncidentIntegrationMetadataPatchRequest{
		Data: datadogV2.IncidentIntegrationMetadataPatchData{
			Attributes: datadogV2.IncidentIntegrationMetadataAttributes{
				IncidentId:      datadog.PtrString(IncidentDataID),
				IntegrationType: 1,
				Metadata: datadogV2.IncidentIntegrationMetadataMetadata{
					SlackIntegrationMetadata: &datadogV2.SlackIntegrationMetadata{
						Channels: []datadogV2.SlackIntegrationMetadataChannelItem{
							{
								ChannelId:   "C0123456789",
								ChannelName: "#updated-channel-name",
								TeamId:      datadog.PtrString("T01234567"),
								RedirectUrl: "https://slack.com/app_redirect?channel=C0123456789&team=T01234567",
							},
						},
					}},
			},
			Type: datadogV2.INCIDENTINTEGRATIONMETADATATYPE_INCIDENT_INTEGRATIONS,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.UpdateIncidentIntegration", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.UpdateIncidentIntegration(ctx, IncidentDataID, IncidentIntegrationMetadataDataID, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.UpdateIncidentIntegration`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.UpdateIncidentIntegration`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Update an existing incident integration metadata returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataAttributes;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataMetadata;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataPatchData;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataPatchRequest;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataResponse;
import com.datadog.api.client.v2.model.IncidentIntegrationMetadataType;
import com.datadog.api.client.v2.model.SlackIntegrationMetadata;
import com.datadog.api.client.v2.model.SlackIntegrationMetadataChannelItem;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.updateIncidentIntegration", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    // the "incident" has an "incident_integration_metadata"
    String INCIDENT_INTEGRATION_METADATA_DATA_ID =
        System.getenv("INCIDENT_INTEGRATION_METADATA_DATA_ID");

    IncidentIntegrationMetadataPatchRequest body =
        new IncidentIntegrationMetadataPatchRequest()
            .data(
                new IncidentIntegrationMetadataPatchData()
                    .attributes(
                        new IncidentIntegrationMetadataAttributes()
                            .incidentId(INCIDENT_DATA_ID)
                            .integrationType(1)
                            .metadata(
                                new IncidentIntegrationMetadataMetadata(
                                    new SlackIntegrationMetadata()
                                        .channels(
                                            Collections.singletonList(
                                                new SlackIntegrationMetadataChannelItem()
                                                    .channelId("C0123456789")
                                                    .channelName("#updated-channel-name")
                                                    .teamId("T01234567")
                                                    .redirectUrl(
                                                        "https://slack.com/app_redirect?channel=C0123456789&team=T01234567"))))))
                    .type(IncidentIntegrationMetadataType.INCIDENT_INTEGRATIONS));

    try {
      IncidentIntegrationMetadataResponse result =
          apiInstance.updateIncidentIntegration(
              INCIDENT_DATA_ID, INCIDENT_INTEGRATION_METADATA_DATA_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#updateIncidentIntegration");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Update an existing incident integration metadata returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_integration_metadata_attributes import IncidentIntegrationMetadataAttributes
from datadog_api_client.v2.model.incident_integration_metadata_patch_data import IncidentIntegrationMetadataPatchData
from datadog_api_client.v2.model.incident_integration_metadata_patch_request import (
    IncidentIntegrationMetadataPatchRequest,
)
from datadog_api_client.v2.model.incident_integration_metadata_type import IncidentIntegrationMetadataType
from datadog_api_client.v2.model.slack_integration_metadata import SlackIntegrationMetadata
from datadog_api_client.v2.model.slack_integration_metadata_channel_item import SlackIntegrationMetadataChannelItem

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

# the "incident" has an "incident_integration_metadata"
INCIDENT_INTEGRATION_METADATA_DATA_ID = environ["INCIDENT_INTEGRATION_METADATA_DATA_ID"]

body = IncidentIntegrationMetadataPatchRequest(
    data=IncidentIntegrationMetadataPatchData(
        attributes=IncidentIntegrationMetadataAttributes(
            incident_id=INCIDENT_DATA_ID,
            integration_type=1,
            metadata=SlackIntegrationMetadata(
                channels=[
                    SlackIntegrationMetadataChannelItem(
                        channel_id="C0123456789",
                        channel_name="#updated-channel-name",
                        team_id="T01234567",
                        redirect_url="https://slack.com/app_redirect?channel=C0123456789&team=T01234567",
                    ),
                ],
            ),
        ),
        type=IncidentIntegrationMetadataType.INCIDENT_INTEGRATIONS,
    ),
)

configuration = Configuration()
configuration.unstable_operations["update_incident_integration"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.update_incident_integration(
        incident_id=INCIDENT_DATA_ID, integration_metadata_id=INCIDENT_INTEGRATION_METADATA_DATA_ID, body=body
    )

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Update an existing incident integration metadata returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.update_incident_integration".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

# the "incident" has an "incident_integration_metadata"
INCIDENT_INTEGRATION_METADATA_DATA_ID = ENV["INCIDENT_INTEGRATION_METADATA_DATA_ID"]

body = DatadogAPIClient::V2::IncidentIntegrationMetadataPatchRequest.new({
  data: DatadogAPIClient::V2::IncidentIntegrationMetadataPatchData.new({
    attributes: DatadogAPIClient::V2::IncidentIntegrationMetadataAttributes.new({
      incident_id: INCIDENT_DATA_ID,
      integration_type: 1,
      metadata: DatadogAPIClient::V2::SlackIntegrationMetadata.new({
        channels: [
          DatadogAPIClient::V2::SlackIntegrationMetadataChannelItem.new({
            channel_id: "C0123456789",
            channel_name: "#updated-channel-name",
            team_id: "T01234567",
            redirect_url: "https://slack.com/app_redirect?channel=C0123456789&team=T01234567",
          }),
        ],
      }),
    }),
    type: DatadogAPIClient::V2::IncidentIntegrationMetadataType::INCIDENT_INTEGRATIONS,
  }),
})
p api_instance.update_incident_integration(INCIDENT_DATA_ID, INCIDENT_INTEGRATION_METADATA_DATA_ID, body)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Update an existing incident integration metadata returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.updateIncidentIntegration"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

// the "incident" has an "incident_integration_metadata"
const INCIDENT_INTEGRATION_METADATA_DATA_ID = process.env
  .INCIDENT_INTEGRATION_METADATA_DATA_ID as string;

const params: v2.IncidentsApiUpdateIncidentIntegrationRequest = {
  body: {
    data: {
      attributes: {
        incidentId: INCIDENT_DATA_ID,
        integrationType: 1,
        metadata: {
          channels: [
            {
              channelId: "C0123456789",
              channelName: "#updated-channel-name",
              teamId: "T01234567",
              redirectUrl:
                "https://slack.com/app_redirect?channel=C0123456789&team=T01234567",
            },
          ],
        },
      },
      type: "incident_integrations",
    },
  },
  incidentId: INCIDENT_DATA_ID,
  integrationMetadataId: INCIDENT_INTEGRATION_METADATA_DATA_ID,
};

apiInstance
  .updateIncidentIntegration(params)
  .then((data: v2.IncidentIntegrationMetadataResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

DELETE https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/integrations/{integration_metadata_id}

개요

Delete an incident integration metadata. This endpoint requires the incident_write authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

integration_metadata_id [required]

string

The UUID of the incident integration metadata.

응답

OK

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Path parameters
export incident_id="CHANGE_ME"
export integration_metadata_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/relationships/integrations/${integration_metadata_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete an incident integration metadata returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

# the "incident" has an "incident_integration_metadata"
INCIDENT_INTEGRATION_METADATA_DATA_ID = environ["INCIDENT_INTEGRATION_METADATA_DATA_ID"]

configuration = Configuration()
configuration.unstable_operations["delete_incident_integration"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    api_instance.delete_incident_integration(
        incident_id=INCIDENT_DATA_ID,
        integration_metadata_id=INCIDENT_INTEGRATION_METADATA_DATA_ID,
    )

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete an incident integration metadata returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.delete_incident_integration".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

# the "incident" has an "incident_integration_metadata"
INCIDENT_INTEGRATION_METADATA_DATA_ID = ENV["INCIDENT_INTEGRATION_METADATA_DATA_ID"]
api_instance.delete_incident_integration(INCIDENT_DATA_ID, INCIDENT_INTEGRATION_METADATA_DATA_ID)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete an incident integration metadata returns "OK" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	// the "incident" has an "incident_integration_metadata"
	IncidentIntegrationMetadataDataID := os.Getenv("INCIDENT_INTEGRATION_METADATA_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.DeleteIncidentIntegration", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	r, err := api.DeleteIncidentIntegration(ctx, IncidentDataID, IncidentIntegrationMetadataDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.DeleteIncidentIntegration`: %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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete an incident integration metadata returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.deleteIncidentIntegration", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    // the "incident" has an "incident_integration_metadata"
    String INCIDENT_INTEGRATION_METADATA_DATA_ID =
        System.getenv("INCIDENT_INTEGRATION_METADATA_DATA_ID");

    try {
      apiInstance.deleteIncidentIntegration(
          INCIDENT_DATA_ID, INCIDENT_INTEGRATION_METADATA_DATA_ID);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#deleteIncidentIntegration");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Delete an incident integration metadata returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.deleteIncidentIntegration"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

// the "incident" has an "incident_integration_metadata"
const INCIDENT_INTEGRATION_METADATA_DATA_ID = process.env
  .INCIDENT_INTEGRATION_METADATA_DATA_ID as string;

const params: v2.IncidentsApiDeleteIncidentIntegrationRequest = {
  incidentId: INCIDENT_DATA_ID,
  integrationMetadataId: INCIDENT_INTEGRATION_METADATA_DATA_ID,
};

apiInstance
  .deleteIncidentIntegration(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

GET https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todoshttps://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/todoshttps://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/todoshttps://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todoshttps://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todoshttps://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos

개요

Get all todos for an incident. This endpoint requires the incident_read authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

응답

OK

Response with a list of incident todos.

Expand All

항목

유형

설명

data [required]

[object]

An array of incident todos.

attributes

object

Incident todo's attributes.

assignees [required]

[ <oneOf>]

Array of todo assignees.

Option 1

string

Assignee's @-handle.

Option 2

object

Anonymous assignee entity.

icon [required]

string

URL for assignee's icon.

id [required]

string

Anonymous assignee's ID.

name [required]

string

Assignee's name.

source [required]

enum

The source of the anonymous assignee. Allowed enum values: slack,microsoft_teams

default: slack

completed

string

Timestamp when the todo was completed.

content [required]

string

The follow-up task's content.

created

date-time

Timestamp when the incident todo was created.

due_date

string

Timestamp when the todo should be completed by.

incident_id

string

UUID of the incident this todo is connected to.

modified

date-time

Timestamp when the incident todo was last modified.

id [required]

string

The incident todo's ID.

relationships

object

The incident's relationships from a response.

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

default: users

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

default: users

type [required]

enum

Todo resource type. Allowed enum values: incident_todos

default: incident_todos

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: 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": {
        "assignees": [
          {
            "description": "undefined",
            "example": "undefined",
            "type": "undefined"
          }
        ],
        "completed": "2023-03-06T22:00:00.000000+00:00",
        "content": "Restore lost data.",
        "created": "2019-09-19T10:00:00.000Z",
        "due_date": "2023-07-10T05:00:00.000000+00:00",
        "incident_id": "00000000-aaaa-0000-0000-000000000000",
        "modified": "2019-09-19T10:00:00.000Z"
      },
      "id": "00000000-0000-0000-1234-000000000000",
      "relationships": {
        "created_by_user": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        },
        "last_modified_by_user": {
          "data": {
            "id": "00000000-0000-0000-2345-000000000000",
            "type": "users"
          }
        }
      },
      "type": "incident_todos"
    }
  ],
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-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

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/relationships/todos" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get a list of an incident's todos returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

configuration = Configuration()
configuration.unstable_operations["list_incident_todos"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.list_incident_todos(
        incident_id=INCIDENT_DATA_ID,
    )

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get a list of an incident's todos returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.list_incident_todos".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]
p api_instance.list_incident_todos(INCIDENT_DATA_ID)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get a list of an incident's todos returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.ListIncidentTodos", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.ListIncidentTodos(ctx, IncidentDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.ListIncidentTodos`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.ListIncidentTodos`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get a list of an incident's todos returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentTodoListResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.listIncidentTodos", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    try {
      IncidentTodoListResponse result = apiInstance.listIncidentTodos(INCIDENT_DATA_ID);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#listIncidentTodos");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get a list of an incident's todos returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.listIncidentTodos"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

const params: v2.IncidentsApiListIncidentTodosRequest = {
  incidentId: INCIDENT_DATA_ID,
};

apiInstance
  .listIncidentTodos(params)
  .then((data: v2.IncidentTodoListResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

POST https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todoshttps://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/todoshttps://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/todoshttps://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todoshttps://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todoshttps://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos

개요

Create an incident todo. This endpoint requires the incident_write authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

요청

Body Data (required)

Incident todo payload.

Expand All

항목

유형

설명

data [required]

object

Incident todo data for a create request.

attributes [required]

object

Incident todo's attributes.

assignees [required]

[ <oneOf>]

Array of todo assignees.

Option 1

string

Assignee's @-handle.

Option 2

object

Anonymous assignee entity.

icon [required]

string

URL for assignee's icon.

id [required]

string

Anonymous assignee's ID.

name [required]

string

Assignee's name.

source [required]

enum

The source of the anonymous assignee. Allowed enum values: slack,microsoft_teams

default: slack

completed

string

Timestamp when the todo was completed.

content [required]

string

The follow-up task's content.

created

date-time

Timestamp when the incident todo was created.

due_date

string

Timestamp when the todo should be completed by.

incident_id

string

UUID of the incident this todo is connected to.

modified

date-time

Timestamp when the incident todo was last modified.

type [required]

enum

Todo resource type. Allowed enum values: incident_todos

default: incident_todos

{
  "data": {
    "attributes": {
      "assignees": [
        "@test.user@test.com"
      ],
      "content": "Restore lost data."
    },
    "type": "incident_todos"
  }
}

응답

CREATED

Response with an incident todo.

Expand All

항목

유형

설명

data [required]

object

Incident todo response data.

attributes

object

Incident todo's attributes.

assignees [required]

[ <oneOf>]

Array of todo assignees.

Option 1

string

Assignee's @-handle.

Option 2

object

Anonymous assignee entity.

icon [required]

string

URL for assignee's icon.

id [required]

string

Anonymous assignee's ID.

name [required]

string

Assignee's name.

source [required]

enum

The source of the anonymous assignee. Allowed enum values: slack,microsoft_teams

default: slack

completed

string

Timestamp when the todo was completed.

content [required]

string

The follow-up task's content.

created

date-time

Timestamp when the incident todo was created.

due_date

string

Timestamp when the todo should be completed by.

incident_id

string

UUID of the incident this todo is connected to.

modified

date-time

Timestamp when the incident todo was last modified.

id [required]

string

The incident todo's ID.

relationships

object

The incident's relationships from a response.

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

default: users

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

default: users

type [required]

enum

Todo resource type. Allowed enum values: incident_todos

default: incident_todos

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

{
  "data": {
    "attributes": {
      "assignees": [
        {
          "description": "undefined",
          "example": "undefined",
          "type": "undefined"
        }
      ],
      "completed": "2023-03-06T22:00:00.000000+00:00",
      "content": "Restore lost data.",
      "created": "2019-09-19T10:00:00.000Z",
      "due_date": "2023-07-10T05:00:00.000000+00:00",
      "incident_id": "00000000-aaaa-0000-0000-000000000000",
      "modified": "2019-09-19T10:00:00.000Z"
    },
    "id": "00000000-0000-0000-1234-000000000000",
    "relationships": {
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      }
    },
    "type": "incident_todos"
  },
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                          # Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/relationships/todos" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "assignees": [ "@test.user@test.com" ], "content": "Restore lost data." }, "type": "incident_todos" } } EOF
// Create an incident todo returns "CREATED" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	body := datadogV2.IncidentTodoCreateRequest{
		Data: datadogV2.IncidentTodoCreateData{
			Attributes: datadogV2.IncidentTodoAttributes{
				Assignees: []datadogV2.IncidentTodoAssignee{
					datadogV2.IncidentTodoAssignee{
						IncidentTodoAssigneeHandle: datadog.PtrString("@test.user@test.com")},
				},
				Content: "Restore lost data.",
			},
			Type: datadogV2.INCIDENTTODOTYPE_INCIDENT_TODOS,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.CreateIncidentTodo", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.CreateIncidentTodo(ctx, IncidentDataID, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.CreateIncidentTodo`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.CreateIncidentTodo`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Create an incident todo returns "CREATED" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentTodoAssignee;
import com.datadog.api.client.v2.model.IncidentTodoAttributes;
import com.datadog.api.client.v2.model.IncidentTodoCreateData;
import com.datadog.api.client.v2.model.IncidentTodoCreateRequest;
import com.datadog.api.client.v2.model.IncidentTodoResponse;
import com.datadog.api.client.v2.model.IncidentTodoType;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.createIncidentTodo", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    IncidentTodoCreateRequest body =
        new IncidentTodoCreateRequest()
            .data(
                new IncidentTodoCreateData()
                    .attributes(
                        new IncidentTodoAttributes()
                            .assignees(
                                Collections.singletonList(
                                    new IncidentTodoAssignee("@test.user@test.com")))
                            .content("Restore lost data."))
                    .type(IncidentTodoType.INCIDENT_TODOS));

    try {
      IncidentTodoResponse result = apiInstance.createIncidentTodo(INCIDENT_DATA_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#createIncidentTodo");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Create an incident todo returns "CREATED" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_todo_assignee_array import IncidentTodoAssigneeArray
from datadog_api_client.v2.model.incident_todo_attributes import IncidentTodoAttributes
from datadog_api_client.v2.model.incident_todo_create_data import IncidentTodoCreateData
from datadog_api_client.v2.model.incident_todo_create_request import IncidentTodoCreateRequest
from datadog_api_client.v2.model.incident_todo_type import IncidentTodoType

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

body = IncidentTodoCreateRequest(
    data=IncidentTodoCreateData(
        attributes=IncidentTodoAttributes(
            assignees=IncidentTodoAssigneeArray(
                [
                    "@test.user@test.com",
                ]
            ),
            content="Restore lost data.",
        ),
        type=IncidentTodoType.INCIDENT_TODOS,
    ),
)

configuration = Configuration()
configuration.unstable_operations["create_incident_todo"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.create_incident_todo(incident_id=INCIDENT_DATA_ID, body=body)

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Create an incident todo returns "CREATED" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.create_incident_todo".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

body = DatadogAPIClient::V2::IncidentTodoCreateRequest.new({
  data: DatadogAPIClient::V2::IncidentTodoCreateData.new({
    attributes: DatadogAPIClient::V2::IncidentTodoAttributes.new({
      assignees: [
        "@test.user@test.com",
      ],
      content: "Restore lost data.",
    }),
    type: DatadogAPIClient::V2::IncidentTodoType::INCIDENT_TODOS,
  }),
})
p api_instance.create_incident_todo(INCIDENT_DATA_ID, body)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Create an incident todo returns "CREATED" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.createIncidentTodo"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

const params: v2.IncidentsApiCreateIncidentTodoRequest = {
  body: {
    data: {
      attributes: {
        assignees: ["@test.user@test.com"],
        content: "Restore lost data.",
      },
      type: "incident_todos",
    },
  },
  incidentId: INCIDENT_DATA_ID,
};

apiInstance
  .createIncidentTodo(params)
  .then((data: v2.IncidentTodoResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

GET https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}

개요

Get incident todo details. This endpoint requires the incident_read authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

todo_id [required]

string

The UUID of the incident todo.

응답

OK

Response with an incident todo.

Expand All

항목

유형

설명

data [required]

object

Incident todo response data.

attributes

object

Incident todo's attributes.

assignees [required]

[ <oneOf>]

Array of todo assignees.

Option 1

string

Assignee's @-handle.

Option 2

object

Anonymous assignee entity.

icon [required]

string

URL for assignee's icon.

id [required]

string

Anonymous assignee's ID.

name [required]

string

Assignee's name.

source [required]

enum

The source of the anonymous assignee. Allowed enum values: slack,microsoft_teams

default: slack

completed

string

Timestamp when the todo was completed.

content [required]

string

The follow-up task's content.

created

date-time

Timestamp when the incident todo was created.

due_date

string

Timestamp when the todo should be completed by.

incident_id

string

UUID of the incident this todo is connected to.

modified

date-time

Timestamp when the incident todo was last modified.

id [required]

string

The incident todo's ID.

relationships

object

The incident's relationships from a response.

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

default: users

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

default: users

type [required]

enum

Todo resource type. Allowed enum values: incident_todos

default: incident_todos

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

{
  "data": {
    "attributes": {
      "assignees": [
        {
          "description": "undefined",
          "example": "undefined",
          "type": "undefined"
        }
      ],
      "completed": "2023-03-06T22:00:00.000000+00:00",
      "content": "Restore lost data.",
      "created": "2019-09-19T10:00:00.000Z",
      "due_date": "2023-07-10T05:00:00.000000+00:00",
      "incident_id": "00000000-aaaa-0000-0000-000000000000",
      "modified": "2019-09-19T10:00:00.000Z"
    },
    "id": "00000000-0000-0000-1234-000000000000",
    "relationships": {
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      }
    },
    "type": "incident_todos"
  },
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \ -H "Accept: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Get incident todo details returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

# the "incident" has an "incident_todo"
INCIDENT_TODO_DATA_ID = environ["INCIDENT_TODO_DATA_ID"]

configuration = Configuration()
configuration.unstable_operations["get_incident_todo"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.get_incident_todo(
        incident_id=INCIDENT_DATA_ID,
        todo_id=INCIDENT_TODO_DATA_ID,
    )

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Get incident todo details returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.get_incident_todo".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

# the "incident" has an "incident_todo"
INCIDENT_TODO_DATA_ID = ENV["INCIDENT_TODO_DATA_ID"]
p api_instance.get_incident_todo(INCIDENT_DATA_ID, INCIDENT_TODO_DATA_ID)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Get incident todo details returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	// the "incident" has an "incident_todo"
	IncidentTodoDataID := os.Getenv("INCIDENT_TODO_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.GetIncidentTodo", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.GetIncidentTodo(ctx, IncidentDataID, IncidentTodoDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.GetIncidentTodo`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.GetIncidentTodo`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Get incident todo details returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentTodoResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.getIncidentTodo", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    // the "incident" has an "incident_todo"
    String INCIDENT_TODO_DATA_ID = System.getenv("INCIDENT_TODO_DATA_ID");

    try {
      IncidentTodoResponse result =
          apiInstance.getIncidentTodo(INCIDENT_DATA_ID, INCIDENT_TODO_DATA_ID);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#getIncidentTodo");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Get incident todo details returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.getIncidentTodo"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

// the "incident" has an "incident_todo"
const INCIDENT_TODO_DATA_ID = process.env.INCIDENT_TODO_DATA_ID as string;

const params: v2.IncidentsApiGetIncidentTodoRequest = {
  incidentId: INCIDENT_DATA_ID,
  todoId: INCIDENT_TODO_DATA_ID,
};

apiInstance
  .getIncidentTodo(params)
  .then((data: v2.IncidentTodoResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

PATCH https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}

개요

Update an incident todo. This endpoint requires the incident_write authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

todo_id [required]

string

The UUID of the incident todo.

요청

Body Data (required)

Incident todo payload.

Expand All

항목

유형

설명

data [required]

object

Incident todo data for a patch request.

attributes [required]

object

Incident todo's attributes.

assignees [required]

[ <oneOf>]

Array of todo assignees.

Option 1

string

Assignee's @-handle.

Option 2

object

Anonymous assignee entity.

icon [required]

string

URL for assignee's icon.

id [required]

string

Anonymous assignee's ID.

name [required]

string

Assignee's name.

source [required]

enum

The source of the anonymous assignee. Allowed enum values: slack,microsoft_teams

default: slack

completed

string

Timestamp when the todo was completed.

content [required]

string

The follow-up task's content.

created

date-time

Timestamp when the incident todo was created.

due_date

string

Timestamp when the todo should be completed by.

incident_id

string

UUID of the incident this todo is connected to.

modified

date-time

Timestamp when the incident todo was last modified.

type [required]

enum

Todo resource type. Allowed enum values: incident_todos

default: incident_todos

{
  "data": {
    "attributes": {
      "assignees": [
        "@test.user@test.com"
      ],
      "content": "Restore lost data.",
      "completed": "2023-03-06T22:00:00.000000+00:00",
      "due_date": "2023-07-10T05:00:00.000000+00:00"
    },
    "type": "incident_todos"
  }
}

응답

OK

Response with an incident todo.

Expand All

항목

유형

설명

data [required]

object

Incident todo response data.

attributes

object

Incident todo's attributes.

assignees [required]

[ <oneOf>]

Array of todo assignees.

Option 1

string

Assignee's @-handle.

Option 2

object

Anonymous assignee entity.

icon [required]

string

URL for assignee's icon.

id [required]

string

Anonymous assignee's ID.

name [required]

string

Assignee's name.

source [required]

enum

The source of the anonymous assignee. Allowed enum values: slack,microsoft_teams

default: slack

completed

string

Timestamp when the todo was completed.

content [required]

string

The follow-up task's content.

created

date-time

Timestamp when the incident todo was created.

due_date

string

Timestamp when the todo should be completed by.

incident_id

string

UUID of the incident this todo is connected to.

modified

date-time

Timestamp when the incident todo was last modified.

id [required]

string

The incident todo's ID.

relationships

object

The incident's relationships from a response.

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

default: users

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

default: users

type [required]

enum

Todo resource type. Allowed enum values: incident_todos

default: incident_todos

included

[ <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.

service_account

boolean

Whether the user is a service account.

status

string

Status of the user.

title

string

Title of the user.

verified

boolean

Whether the user is verified.

id

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

default: 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

default: 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

default: users

roles

object

Relationship to roles.

data

[object]

An array containing type and the unique identifier of a role.

id

string

The unique identifier of the role.

type

enum

Roles type. Allowed enum values: roles

default: roles

type

enum

Users resource type. Allowed enum values: users

default: users

{
  "data": {
    "attributes": {
      "assignees": [
        {
          "description": "undefined",
          "example": "undefined",
          "type": "undefined"
        }
      ],
      "completed": "2023-03-06T22:00:00.000000+00:00",
      "content": "Restore lost data.",
      "created": "2019-09-19T10:00:00.000Z",
      "due_date": "2023-07-10T05:00:00.000000+00:00",
      "incident_id": "00000000-aaaa-0000-0000-000000000000",
      "modified": "2019-09-19T10:00:00.000Z"
    },
    "id": "00000000-0000-0000-1234-000000000000",
    "relationships": {
      "created_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      },
      "last_modified_by_user": {
        "data": {
          "id": "00000000-0000-0000-2345-000000000000",
          "type": "users"
        }
      }
    },
    "type": "incident_todos"
  },
  "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",
        "service_account": false,
        "status": "string",
        "title": "string",
        "verified": false
      },
      "id": "string",
      "relationships": {
        "org": {
          "data": {
            "id": "00000000-0000-beef-0000-000000000000",
            "type": "orgs"
          }
        },
        "other_orgs": {
          "data": [
            {
              "id": "00000000-0000-beef-0000-000000000000",
              "type": "orgs"
            }
          ]
        },
        "other_users": {
          "data": [
            {
              "id": "00000000-0000-0000-2345-000000000000",
              "type": "users"
            }
          ]
        },
        "roles": {
          "data": [
            {
              "id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d",
              "type": "roles"
            }
          ]
        }
      },
      "type": "users"
    }
  ]
}

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                          # Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "data": { "attributes": { "assignees": [ "@test.user@test.com" ], "content": "Restore lost data.", "completed": "2023-03-06T22:00:00.000000+00:00", "due_date": "2023-07-10T05:00:00.000000+00:00" }, "type": "incident_todos" } } EOF
// Update an incident todo returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	// the "incident" has an "incident_todo"
	IncidentTodoDataID := os.Getenv("INCIDENT_TODO_DATA_ID")

	body := datadogV2.IncidentTodoPatchRequest{
		Data: datadogV2.IncidentTodoPatchData{
			Attributes: datadogV2.IncidentTodoAttributes{
				Assignees: []datadogV2.IncidentTodoAssignee{
					datadogV2.IncidentTodoAssignee{
						IncidentTodoAssigneeHandle: datadog.PtrString("@test.user@test.com")},
				},
				Content:   "Restore lost data.",
				Completed: *datadog.NewNullableString(datadog.PtrString("2023-03-06T22:00:00.000000+00:00")),
				DueDate:   *datadog.NewNullableString(datadog.PtrString("2023-07-10T05:00:00.000000+00:00")),
			},
			Type: datadogV2.INCIDENTTODOTYPE_INCIDENT_TODOS,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.UpdateIncidentTodo", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	resp, r, err := api.UpdateIncidentTodo(ctx, IncidentDataID, IncidentTodoDataID, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.UpdateIncidentTodo`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `IncidentsApi.UpdateIncidentTodo`:\n%s\n", responseContent)
}

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Update an incident todo returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;
import com.datadog.api.client.v2.model.IncidentTodoAssignee;
import com.datadog.api.client.v2.model.IncidentTodoAttributes;
import com.datadog.api.client.v2.model.IncidentTodoPatchData;
import com.datadog.api.client.v2.model.IncidentTodoPatchRequest;
import com.datadog.api.client.v2.model.IncidentTodoResponse;
import com.datadog.api.client.v2.model.IncidentTodoType;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.updateIncidentTodo", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    // the "incident" has an "incident_todo"
    String INCIDENT_TODO_DATA_ID = System.getenv("INCIDENT_TODO_DATA_ID");

    IncidentTodoPatchRequest body =
        new IncidentTodoPatchRequest()
            .data(
                new IncidentTodoPatchData()
                    .attributes(
                        new IncidentTodoAttributes()
                            .assignees(
                                Collections.singletonList(
                                    new IncidentTodoAssignee("@test.user@test.com")))
                            .content("Restore lost data.")
                            .completed("2023-03-06T22:00:00.000000+00:00")
                            .dueDate("2023-07-10T05:00:00.000000+00:00"))
                    .type(IncidentTodoType.INCIDENT_TODOS));

    try {
      IncidentTodoResponse result =
          apiInstance.updateIncidentTodo(INCIDENT_DATA_ID, INCIDENT_TODO_DATA_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#updateIncidentTodo");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
"""
Update an incident todo returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
from datadog_api_client.v2.model.incident_todo_assignee_array import IncidentTodoAssigneeArray
from datadog_api_client.v2.model.incident_todo_attributes import IncidentTodoAttributes
from datadog_api_client.v2.model.incident_todo_patch_data import IncidentTodoPatchData
from datadog_api_client.v2.model.incident_todo_patch_request import IncidentTodoPatchRequest
from datadog_api_client.v2.model.incident_todo_type import IncidentTodoType

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

# the "incident" has an "incident_todo"
INCIDENT_TODO_DATA_ID = environ["INCIDENT_TODO_DATA_ID"]

body = IncidentTodoPatchRequest(
    data=IncidentTodoPatchData(
        attributes=IncidentTodoAttributes(
            assignees=IncidentTodoAssigneeArray(
                [
                    "@test.user@test.com",
                ]
            ),
            content="Restore lost data.",
            completed="2023-03-06T22:00:00.000000+00:00",
            due_date="2023-07-10T05:00:00.000000+00:00",
        ),
        type=IncidentTodoType.INCIDENT_TODOS,
    ),
)

configuration = Configuration()
configuration.unstable_operations["update_incident_todo"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    response = api_instance.update_incident_todo(incident_id=INCIDENT_DATA_ID, todo_id=INCIDENT_TODO_DATA_ID, body=body)

    print(response)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Update an incident todo returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.update_incident_todo".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

# the "incident" has an "incident_todo"
INCIDENT_TODO_DATA_ID = ENV["INCIDENT_TODO_DATA_ID"]

body = DatadogAPIClient::V2::IncidentTodoPatchRequest.new({
  data: DatadogAPIClient::V2::IncidentTodoPatchData.new({
    attributes: DatadogAPIClient::V2::IncidentTodoAttributes.new({
      assignees: [
        "@test.user@test.com",
      ],
      content: "Restore lost data.",
      completed: "2023-03-06T22:00:00.000000+00:00",
      due_date: "2023-07-10T05:00:00.000000+00:00",
    }),
    type: DatadogAPIClient::V2::IncidentTodoType::INCIDENT_TODOS,
  }),
})
p api_instance.update_incident_todo(INCIDENT_DATA_ID, INCIDENT_TODO_DATA_ID, body)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
/**
 * Update an incident todo returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.updateIncidentTodo"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

// the "incident" has an "incident_todo"
const INCIDENT_TODO_DATA_ID = process.env.INCIDENT_TODO_DATA_ID as string;

const params: v2.IncidentsApiUpdateIncidentTodoRequest = {
  body: {
    data: {
      attributes: {
        assignees: ["@test.user@test.com"],
        content: "Restore lost data.",
        completed: "2023-03-06T22:00:00.000000+00:00",
        dueDate: "2023-07-10T05:00:00.000000+00:00",
      },
      type: "incident_todos",
    },
  },
  incidentId: INCIDENT_DATA_ID,
  todoId: INCIDENT_TODO_DATA_ID,
};

apiInstance
  .updateIncidentTodo(params)
  .then((data: v2.IncidentTodoResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"

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

DELETE https://api.ap1.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.datadoghq.eu/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}https://api.us5.datadoghq.com/api/v2/incidents/{incident_id}/relationships/todos/{todo_id}

개요

Delete an incident todo. This endpoint requires the incident_write authorization scope.

인수

Path Parameters

이름

유형

설명

incident_id [required]

string

The UUID of the incident.

todo_id [required]

string

The UUID of the incident todo.

응답

OK

Bad Request

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Unauthorized

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Forbidden

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Too many requests

API error response.

Expand All

항목

유형

설명

errors [required]

[string]

A list of errors.

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

Code Example

                  # Path parameters
export incident_id="CHANGE_ME"
export todo_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.ap1.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/incidents/${incident_id}/relationships/todos/${todo_id}" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}"
"""
Delete an incident todo returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi

# there is a valid "incident" in the system
INCIDENT_DATA_ID = environ["INCIDENT_DATA_ID"]

# the "incident" has an "incident_todo"
INCIDENT_TODO_DATA_ID = environ["INCIDENT_TODO_DATA_ID"]

configuration = Configuration()
configuration.unstable_operations["delete_incident_todo"] = True
with ApiClient(configuration) as api_client:
    api_instance = IncidentsApi(api_client)
    api_instance.delete_incident_todo(
        incident_id=INCIDENT_DATA_ID,
        todo_id=INCIDENT_TODO_DATA_ID,
    )

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
# Delete an incident todo returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.unstable_operations["v2.delete_incident_todo".to_sym] = true
end
api_instance = DatadogAPIClient::V2::IncidentsAPI.new

# there is a valid "incident" in the system
INCIDENT_DATA_ID = ENV["INCIDENT_DATA_ID"]

# the "incident" has an "incident_todo"
INCIDENT_TODO_DATA_ID = ENV["INCIDENT_TODO_DATA_ID"]
api_instance.delete_incident_todo(INCIDENT_DATA_ID, INCIDENT_TODO_DATA_ID)

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
// Delete an incident todo returns "OK" response

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	// there is a valid "incident" in the system
	IncidentDataID := os.Getenv("INCIDENT_DATA_ID")

	// the "incident" has an "incident_todo"
	IncidentTodoDataID := os.Getenv("INCIDENT_TODO_DATA_ID")

	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.DeleteIncidentTodo", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewIncidentsApi(apiClient)
	r, err := api.DeleteIncidentTodo(ctx, IncidentDataID, IncidentTodoDataID)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.DeleteIncidentTodo`: %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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
// Delete an incident todo returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.IncidentsApi;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setUnstableOperationEnabled("v2.deleteIncidentTodo", true);
    IncidentsApi apiInstance = new IncidentsApi(defaultClient);

    // there is a valid "incident" in the system
    String INCIDENT_DATA_ID = System.getenv("INCIDENT_DATA_ID");

    // the "incident" has an "incident_todo"
    String INCIDENT_TODO_DATA_ID = System.getenv("INCIDENT_TODO_DATA_ID");

    try {
      apiInstance.deleteIncidentTodo(INCIDENT_DATA_ID, INCIDENT_TODO_DATA_ID);
    } catch (ApiException e) {
      System.err.println("Exception when calling IncidentsApi#deleteIncidentTodo");
      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:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
/**
 * Delete an incident todo returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
configuration.unstableOperations["v2.deleteIncidentTodo"] = true;
const apiInstance = new v2.IncidentsApi(configuration);

// there is a valid "incident" in the system
const INCIDENT_DATA_ID = process.env.INCIDENT_DATA_ID as string;

// the "incident" has an "incident_todo"
const INCIDENT_TODO_DATA_ID = process.env.INCIDENT_TODO_DATA_ID as string;

const params: v2.IncidentsApiDeleteIncidentTodoRequest = {
  incidentId: INCIDENT_DATA_ID,
  todoId: INCIDENT_TODO_DATA_ID,
};

apiInstance
  .deleteIncidentTodo(params)
  .then((data: any) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

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

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"