Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
POST https://api.datadoghq.eu/api/v2/incidentshttps://api.ddog-gov.com/api/v2/incidentshttps://api.datadoghq.com/api/v2/incidentshttps://api.us3.datadoghq.com/api/v2/incidents
Create an incident.
Incident payload.
Field
Type
Description
data [required]
object
Incident data for a create request.
attributes [required]
object
The incident's attributes for a create request.
customer_impacted [required]
boolean
A flag indicating whether the incident caused customer impact.
fields
object
A condensed view of the user-defined fields for which to create initial selections.
<any-key>
object <oneOf>
Dynamic fields for which selections can be made, with field names as keys.
Option 1
object
A field with a single value selected.
type
enum
Type of the single value field definitions.
Allowed enum values: dropdown,textbox
value
string
The single value selected for this field.
Option 2
object
A field with potentially multiple values selected.
type
enum
Type of the single value field definitions.
Allowed enum values: multiselect,textarray,metrictag,autocomplete
value
[string]
The multiple values selected for this field.
initial_timeline_cells
[object <oneOf>]
An array of initial timeline cells to be placed at the beginning of the incident timeline.
Option 1
object
Timeline cell data for Markdown timeline cells for a create request.
cell_type [required]
enum
Type of the Markdown timeline cell.
Allowed enum values: markdown
content [required]
object
The Markdown timeline cell contents.
content [required]
string
The Markdown content of the cell.
important
boolean
A flag indicating whether the timeline cell is important and should be highlighted.
notification_handles
[string]
Notification handles that will be notified of the incident at creation.
title [required]
string
The title of the incident, which summarizes what happened.
relationships
object
The relationships the incident will have with other resources once created.
commander [required]
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
type [required]
enum
Incident resource type.
Allowed enum values: incidents
{
"data": {
"attributes": {
"customer_impacted": false,
"fields": {
"<any-key>": {}
},
"initial_timeline_cells": [],
"notification_handles": [
"@test.user@test.com"
],
"title": "A test incident title"
},
"relationships": {
"commander": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
}
},
"type": "incidents"
}
}
CREATED
Response with an incident.
Field
Type
Description
data [required]
object
Incident data from a response.
attributes
object
The incident's attributes from a response.
created
date-time
Timestamp when the incident was created.
customer_impact_duration
int64
Length of the incident's customer impact in seconds.
Equals the difference between customer_impact_start
and customer_impact_end
.
customer_impact_end
date-time
Timestamp when customers were no longer impacted by the incident.
customer_impact_scope
string
A summary of the impact customers experienced during the incident.
customer_impact_start
date-time
Timestamp when customers began being impacted by the incident.
customer_impacted
boolean
A flag indicating whether the incident caused customer impact.
detected
date-time
Timestamp when the incident was detected.
fields
object
A condensed view of the user-defined fields attached to incidents.
<any-key>
object <oneOf>
Dynamic fields for which selections can be made, with field names as keys.
Option 1
object
A field with a single value selected.
type
enum
Type of the single value field definitions.
Allowed enum values: dropdown,textbox
value
string
The single value selected for this field.
Option 2
object
A field with potentially multiple values selected.
type
enum
Type of the single value field definitions.
Allowed enum values: multiselect,textarray,metrictag,autocomplete
value
[string]
The multiple values selected for this field.
modified
date-time
Timestamp when the incident was last modified.
notification_handles
[string]
Notification handles that will be notified of the incident during update.
postmortem_id
string
The UUID of the postmortem object attached to the incident.
public_id
int64
The monotonically increasing integer ID for the incident.
resolved
date-time
Timestamp when the incident's state was set to resolved.
time_to_detect
int64
The amount of time in seconds to detect the incident.
Equals the difference between customer_impact_start
and detected
.
time_to_internal_response
int64
The amount of time in seconds to call incident after detection. Equals the difference of detected
and created
.
time_to_repair
int64
The amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between customer_impact_end
and detected
.
time_to_resolve
int64
The amount of time in seconds to resolve the incident after it was created. Equals the difference between created
and resolved
.
title [required]
string
The title of the incident, which summarizes what happened.
id [required]
string
The incident's ID.
relationships
object
The incident's relationships from a response.
commander_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
created_by_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
integrations
object
A relationship reference for multiple integration metadata objects.
data [required]
[object]
The integration metadata relationship array
id [required]
string
A unique identifier that represents the integration metadata.
type [required]
enum
Integration metadata resource type.
Allowed enum values: incident_integration_metadata
last_modified_by_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
postmortem
object
A relationship reference for postmortems.
data [required]
object
The postmortem relationship data.
id [required]
string
A unique identifier that represents the postmortem.
type [required]
enum
Incident postmortem resource type.
Allowed enum values: incident_postmortems
type [required]
enum
Incident resource type.
Allowed enum values: incidents
included
[object <oneOf>]
Included related resources that the user requested.
Option 1
object
User object returned by the API.
attributes
object
Attributes of user object returned by the API.
created_at
date-time
Creation time of the user.
disabled
boolean
Whether the user is disabled.
string
Email of the user.
handle
string
Handle of the user.
icon
string
URL of the user's icon.
name
string
Name of the user.
status
string
Status of the user.
title
string
Title of the user.
verified
boolean
Whether the user is verified.
id [required]
string
ID of the user.
relationships
object
Relationships of the user object returned by the API.
org
object
Relationship to an organization.
data [required]
object
Relationship to organization object.
id [required]
string
ID of the organization.
type [required]
enum
Organizations resource type.
Allowed enum values: orgs
other_orgs
object
Relationship to organizations.
data [required]
[object]
Relationships to organization objects.
id [required]
string
ID of the organization.
type [required]
enum
Organizations resource type.
Allowed enum values: orgs
other_users
object
Relationship to users.
data [required]
[object]
Relationships to user objects.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
roles
object
Relationship to roles.
data [required]
[object]
An array containing type and ID of a role.
id
string
ID of the role.
type
enum
Roles type.
Allowed enum values: roles
type [required]
enum
Users resource type.
Allowed enum values: users
{
"data": {
"attributes": {
"created": "2019-09-19T10:00:00.000Z",
"customer_impact_duration": "integer",
"customer_impact_end": "2019-09-19T10:00:00.000Z",
"customer_impact_scope": "An example customer impact scope",
"customer_impact_start": "2019-09-19T10:00:00.000Z",
"customer_impacted": false,
"detected": "2019-09-19T10:00:00.000Z",
"fields": {
"<any-key>": {}
},
"modified": "2019-09-19T10:00:00.000Z",
"notification_handles": [
"@test.user@test.com"
],
"postmortem_id": "00000000-0000-0000-0000-000000000000",
"public_id": 1,
"resolved": "2019-09-19T10:00:00.000Z",
"time_to_detect": "integer",
"time_to_internal_response": "integer",
"time_to_repair": "integer",
"time_to_resolve": "integer",
"title": "A test incident title"
},
"id": "00000000-0000-0000-0000-000000000000",
"relationships": {
"commander_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"created_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"integrations": {
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_integration_metadata"
}
]
},
"last_modified_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"postmortem": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_postmortems"
}
}
},
"type": "incidents"
},
"included": []
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Unauthorized
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X POST "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/incidents" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
"data": {
"attributes": {
"customer_impacted": false,
"title": "A test incident title"
},
"relationships": {
"commander": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
}
},
"type": "incidents"
}
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
if site, ok := os.LookupEnv("DD_SITE"); ok {
ctx = context.WithValue(
ctx,
datadog.ContextServerVariables,
map[string]string{"site": site},
)
}
body := *datadog.NewIncidentCreateRequest(*datadog.NewIncidentCreateData(*datadog.NewIncidentCreateAttributes(false, "A test incident title"), datadog.IncidentType("incidents"))) // IncidentCreateRequest | Incident payload.
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("CreateIncident", true)
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.IncidentsApi.CreateIncident(ctx).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.CreateIncident``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `CreateIncident`: IncidentResponse
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from IncidentsApi.CreateIncident:\n%s\n", response_content)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.IncidentsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);
IncidentCreateRequest body = new IncidentCreateRequest(); // IncidentCreateRequest | Incident payload.
try {
IncidentResponse result = apiInstance.createIncident()
.body(body)
.execute();
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();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import incidents_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
configuration.server_variables["site"] = os.environ["DD_SITE"]
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
configuration.unstable_operations["create_incident"] = True
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = incidents_api.IncidentsApi(api_client)
body = IncidentCreateRequest(
data=IncidentCreateData(
attributes=IncidentCreateAttributes(
customer_impacted=False,
fields={
"key": IncidentFieldAttributes(),
},
initial_timeline_cells=[
IncidentTimelineCellCreateAttributes(),
],
notification_handles=[
"@test.user@test.com",
],
title="A test incident title",
),
relationships=IncidentCreateRelationships(
commander=RelationshipToUser(
data=RelationshipToUserData(
id="00000000-0000-0000-0000-000000000000",
type=UsersType("users"),
),
),
),
type=IncidentType("incidents"),
),
) # IncidentCreateRequest | Incident payload.
# example passing only required values which don't have defaults set
try:
# Create an incident
api_response = api_instance.create_incident(body)
pprint(api_response)
except ApiException as e:
print("Exception when calling IncidentsApi->create_incident: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
python3 "example.py"
require 'time'
require 'datadog_api_client'
DatadogAPIClient::V2.configure do |config|
# Defining the site is optional and defaults to datadoghq.com
config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
# setup authorization
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
config.unstable_operations[:create_incident] = true
end
api_instance = DatadogAPIClient::V2::IncidentsApi.new
body = DatadogAPIClient::V2::IncidentCreateRequest.new({data: DatadogAPIClient::V2::IncidentCreateData.new({attributes: DatadogAPIClient::V2::IncidentCreateAttributes.new({customer_impacted: false, title: 'A test incident title'}), type: DatadogAPIClient::V2::IncidentType::INCIDENTS})}) # IncidentCreateRequest | Incident payload.
begin
# Create an incident
result = api_instance.create_incident(body)
p result
rescue DatadogAPIClient::V2::ApiError => e
puts "Error when calling IncidentsApi->create_incident: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
rb "example.rb"
Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
DELETE https://api.datadoghq.eu/api/v2/incidents/{incident_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}
Deletes an existing incident from the users organization.
Name
Type
Description
incident_id [required]
string
The UUID the incident.
OK
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Unauthorized
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X DELETE "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/incidents/${incident_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
if site, ok := os.LookupEnv("DD_SITE"); ok {
ctx = context.WithValue(
ctx,
datadog.ContextServerVariables,
map[string]string{"site": site},
)
}
incidentId := "incidentId_example" // string | The UUID the incident.
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("DeleteIncident", true)
api_client := datadog.NewAPIClient(configuration)
r, err := api_client.IncidentsApi.DeleteIncident(ctx, incidentId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.DeleteIncident``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.IncidentsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);
String incidentId = "incidentId_example"; // String | The UUID the incident.
try {
apiInstance.deleteIncident(incidentId)
.execute();
} 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();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import incidents_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
configuration.server_variables["site"] = os.environ["DD_SITE"]
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
configuration.unstable_operations["delete_incident"] = True
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = incidents_api.IncidentsApi(api_client)
incident_id = "incident_id_example" # str | The UUID the incident.
# example passing only required values which don't have defaults set
try:
# Delete an existing incident
api_instance.delete_incident(incident_id)
except ApiException as e:
print("Exception when calling IncidentsApi->delete_incident: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
python3 "example.py"
require 'time'
require 'datadog_api_client'
DatadogAPIClient::V2.configure do |config|
# Defining the site is optional and defaults to datadoghq.com
config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
# setup authorization
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
config.unstable_operations[:delete_incident] = true
end
api_instance = DatadogAPIClient::V2::IncidentsApi.new
incident_id = 'incident_id_example' # String | The UUID the incident.
begin
# Delete an existing incident
api_instance.delete_incident(incident_id)
rescue DatadogAPIClient::V2::ApiError => e
puts "Error when calling IncidentsApi->delete_incident: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
rb "example.rb"
Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
GET https://api.datadoghq.eu/api/v2/incidentshttps://api.ddog-gov.com/api/v2/incidentshttps://api.datadoghq.com/api/v2/incidentshttps://api.us3.datadoghq.com/api/v2/incidents
Get all incidents for the user’s organization.
Name
Type
Description
include
array
Specifies which types of related objects should be included in the response.
page[size]
integer
Size for a given page.
page[offset]
integer
Specific offset to use as the beginning of the returned page.
OK
Response with a list of incidents.
Field
Type
Description
data [required]
[object]
An array of incidents.
attributes
object
The incident's attributes from a response.
created
date-time
Timestamp when the incident was created.
customer_impact_duration
int64
Length of the incident's customer impact in seconds.
Equals the difference between customer_impact_start
and customer_impact_end
.
customer_impact_end
date-time
Timestamp when customers were no longer impacted by the incident.
customer_impact_scope
string
A summary of the impact customers experienced during the incident.
customer_impact_start
date-time
Timestamp when customers began being impacted by the incident.
customer_impacted
boolean
A flag indicating whether the incident caused customer impact.
detected
date-time
Timestamp when the incident was detected.
fields
object
A condensed view of the user-defined fields attached to incidents.
<any-key>
object <oneOf>
Dynamic fields for which selections can be made, with field names as keys.
Option 1
object
A field with a single value selected.
type
enum
Type of the single value field definitions.
Allowed enum values: dropdown,textbox
value
string
The single value selected for this field.
Option 2
object
A field with potentially multiple values selected.
type
enum
Type of the single value field definitions.
Allowed enum values: multiselect,textarray,metrictag,autocomplete
value
[string]
The multiple values selected for this field.
modified
date-time
Timestamp when the incident was last modified.
notification_handles
[string]
Notification handles that will be notified of the incident during update.
postmortem_id
string
The UUID of the postmortem object attached to the incident.
public_id
int64
The monotonically increasing integer ID for the incident.
resolved
date-time
Timestamp when the incident's state was set to resolved.
time_to_detect
int64
The amount of time in seconds to detect the incident.
Equals the difference between customer_impact_start
and detected
.
time_to_internal_response
int64
The amount of time in seconds to call incident after detection. Equals the difference of detected
and created
.
time_to_repair
int64
The amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between customer_impact_end
and detected
.
time_to_resolve
int64
The amount of time in seconds to resolve the incident after it was created. Equals the difference between created
and resolved
.
title [required]
string
The title of the incident, which summarizes what happened.
id [required]
string
The incident's ID.
relationships
object
The incident's relationships from a response.
commander_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
created_by_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
integrations
object
A relationship reference for multiple integration metadata objects.
data [required]
[object]
The integration metadata relationship array
id [required]
string
A unique identifier that represents the integration metadata.
type [required]
enum
Integration metadata resource type.
Allowed enum values: incident_integration_metadata
last_modified_by_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
postmortem
object
A relationship reference for postmortems.
data [required]
object
The postmortem relationship data.
id [required]
string
A unique identifier that represents the postmortem.
type [required]
enum
Incident postmortem resource type.
Allowed enum values: incident_postmortems
type [required]
enum
Incident resource type.
Allowed enum values: incidents
included
[object <oneOf>]
Included related resources that the user requested.
Option 1
object
User object returned by the API.
attributes
object
Attributes of user object returned by the API.
created_at
date-time
Creation time of the user.
disabled
boolean
Whether the user is disabled.
string
Email of the user.
handle
string
Handle of the user.
icon
string
URL of the user's icon.
name
string
Name of the user.
status
string
Status of the user.
title
string
Title of the user.
verified
boolean
Whether the user is verified.
id [required]
string
ID of the user.
relationships
object
Relationships of the user object returned by the API.
org
object
Relationship to an organization.
data [required]
object
Relationship to organization object.
id [required]
string
ID of the organization.
type [required]
enum
Organizations resource type.
Allowed enum values: orgs
other_orgs
object
Relationship to organizations.
data [required]
[object]
Relationships to organization objects.
id [required]
string
ID of the organization.
type [required]
enum
Organizations resource type.
Allowed enum values: orgs
other_users
object
Relationship to users.
data [required]
[object]
Relationships to user objects.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
roles
object
Relationship to roles.
data [required]
[object]
An array containing type and ID of a role.
id
string
ID of the role.
type
enum
Roles type.
Allowed enum values: roles
type [required]
enum
Users resource type.
Allowed enum values: users
meta
object
The metadata object containing pagination metadata.
pagination
object
Pagination properties.
next_offset
int64
The index of the first element in the next page of results. Equal to page size added to the current offset.
offset
int64
The index of the first element in the results.
size
int64
Maximum size of pages to return.
{
"data": [
{
"attributes": {
"created": "2019-09-19T10:00:00.000Z",
"customer_impact_duration": "integer",
"customer_impact_end": "2019-09-19T10:00:00.000Z",
"customer_impact_scope": "An example customer impact scope",
"customer_impact_start": "2019-09-19T10:00:00.000Z",
"customer_impacted": false,
"detected": "2019-09-19T10:00:00.000Z",
"fields": {
"<any-key>": {}
},
"modified": "2019-09-19T10:00:00.000Z",
"notification_handles": [
"@test.user@test.com"
],
"postmortem_id": "00000000-0000-0000-0000-000000000000",
"public_id": 1,
"resolved": "2019-09-19T10:00:00.000Z",
"time_to_detect": "integer",
"time_to_internal_response": "integer",
"time_to_repair": "integer",
"time_to_resolve": "integer",
"title": "A test incident title"
},
"id": "00000000-0000-0000-0000-000000000000",
"relationships": {
"commander_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"created_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"integrations": {
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_integration_metadata"
}
]
},
"last_modified_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"postmortem": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_postmortems"
}
}
},
"type": "incidents"
}
],
"included": [],
"meta": {
"pagination": {
"next_offset": 1000,
"offset": 10,
"size": 1000
}
}
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Unauthorized
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/incidents" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
if site, ok := os.LookupEnv("DD_SITE"); ok {
ctx = context.WithValue(
ctx,
datadog.ContextServerVariables,
map[string]string{"site": site},
)
}
include := []datadog.IncidentRelatedObject{datadog.IncidentRelatedObject("users")} // []IncidentRelatedObject | Specifies which types of related objects should be included in the response. (optional)
pageSize := int64(789) // int64 | Size for a given page. (optional) (default to 10)
pageOffset := int64(789) // int64 | Specific offset to use as the beginning of the returned page. (optional) (default to 0)
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("ListIncidents", true)
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.IncidentsApi.ListIncidents(ctx).Include(include).PageSize(pageSize).PageOffset(pageOffset).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.ListIncidents``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `ListIncidents`: IncidentsResponse
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from IncidentsApi.ListIncidents:\n%s\n", response_content)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.IncidentsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);
List<IncidentRelatedObject> include = Arrays.asList(); // List<IncidentRelatedObject> | Specifies which types of related objects should be included in the response.
Long pageSize = 10l; // Long | Size for a given page.
Long pageOffset = 0l; // Long | Specific offset to use as the beginning of the returned page.
try {
IncidentsResponse result = apiInstance.listIncidents()
.include(include)
.pageSize(pageSize)
.pageOffset(pageOffset)
.execute();
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();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import incidents_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
configuration.server_variables["site"] = os.environ["DD_SITE"]
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
configuration.unstable_operations["list_incidents"] = True
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = incidents_api.IncidentsApi(api_client)
include = [
IncidentRelatedObject("users"),
] # [IncidentRelatedObject] | Specifies which types of related objects should be included in the response. (optional)
page_size = 10 # int | Size for a given page. (optional) if omitted the server will use the default value of 10
page_offset = 0 # int | Specific offset to use as the beginning of the returned page. (optional) if omitted the server will use the default value of 0
# example passing only required values which don't have defaults set
# and optional values
try:
# Get a list of incidents
api_response = api_instance.list_incidents(include=include, page_size=page_size, page_offset=page_offset)
pprint(api_response)
except ApiException as e:
print("Exception when calling IncidentsApi->list_incidents: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
python3 "example.py"
require 'time'
require 'datadog_api_client'
DatadogAPIClient::V2.configure do |config|
# Defining the site is optional and defaults to datadoghq.com
config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
# setup authorization
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
config.unstable_operations[:list_incidents] = true
end
api_instance = DatadogAPIClient::V2::IncidentsApi.new
opts = {
include: [DatadogAPIClient::V2::IncidentRelatedObject::USERS], # Array<IncidentRelatedObject> | Specifies which types of related objects should be included in the response.
page_size: 789, # Integer | Size for a given page.
page_offset: 789 # Integer | Specific offset to use as the beginning of the returned page.
}
begin
# Get a list of incidents
result = api_instance.list_incidents(opts)
p result
rescue DatadogAPIClient::V2::ApiError => e
puts "Error when calling IncidentsApi->list_incidents: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
rb "example.rb"
Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
GET https://api.datadoghq.eu/api/v2/incidents/{incident_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}
Get the details of an incident by incident_id
.
Name
Type
Description
incident_id [required]
string
The UUID the incident.
Name
Type
Description
include
array
Specifies which types of related objects should be included in the response.
OK
Response with an incident.
Field
Type
Description
data [required]
object
Incident data from a response.
attributes
object
The incident's attributes from a response.
created
date-time
Timestamp when the incident was created.
customer_impact_duration
int64
Length of the incident's customer impact in seconds.
Equals the difference between customer_impact_start
and customer_impact_end
.
customer_impact_end
date-time
Timestamp when customers were no longer impacted by the incident.
customer_impact_scope
string
A summary of the impact customers experienced during the incident.
customer_impact_start
date-time
Timestamp when customers began being impacted by the incident.
customer_impacted
boolean
A flag indicating whether the incident caused customer impact.
detected
date-time
Timestamp when the incident was detected.
fields
object
A condensed view of the user-defined fields attached to incidents.
<any-key>
object <oneOf>
Dynamic fields for which selections can be made, with field names as keys.
Option 1
object
A field with a single value selected.
type
enum
Type of the single value field definitions.
Allowed enum values: dropdown,textbox
value
string
The single value selected for this field.
Option 2
object
A field with potentially multiple values selected.
type
enum
Type of the single value field definitions.
Allowed enum values: multiselect,textarray,metrictag,autocomplete
value
[string]
The multiple values selected for this field.
modified
date-time
Timestamp when the incident was last modified.
notification_handles
[string]
Notification handles that will be notified of the incident during update.
postmortem_id
string
The UUID of the postmortem object attached to the incident.
public_id
int64
The monotonically increasing integer ID for the incident.
resolved
date-time
Timestamp when the incident's state was set to resolved.
time_to_detect
int64
The amount of time in seconds to detect the incident.
Equals the difference between customer_impact_start
and detected
.
time_to_internal_response
int64
The amount of time in seconds to call incident after detection. Equals the difference of detected
and created
.
time_to_repair
int64
The amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between customer_impact_end
and detected
.
time_to_resolve
int64
The amount of time in seconds to resolve the incident after it was created. Equals the difference between created
and resolved
.
title [required]
string
The title of the incident, which summarizes what happened.
id [required]
string
The incident's ID.
relationships
object
The incident's relationships from a response.
commander_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
created_by_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
integrations
object
A relationship reference for multiple integration metadata objects.
data [required]
[object]
The integration metadata relationship array
id [required]
string
A unique identifier that represents the integration metadata.
type [required]
enum
Integration metadata resource type.
Allowed enum values: incident_integration_metadata
last_modified_by_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
postmortem
object
A relationship reference for postmortems.
data [required]
object
The postmortem relationship data.
id [required]
string
A unique identifier that represents the postmortem.
type [required]
enum
Incident postmortem resource type.
Allowed enum values: incident_postmortems
type [required]
enum
Incident resource type.
Allowed enum values: incidents
included
[object <oneOf>]
Included related resources that the user requested.
Option 1
object
User object returned by the API.
attributes
object
Attributes of user object returned by the API.
created_at
date-time
Creation time of the user.
disabled
boolean
Whether the user is disabled.
string
Email of the user.
handle
string
Handle of the user.
icon
string
URL of the user's icon.
name
string
Name of the user.
status
string
Status of the user.
title
string
Title of the user.
verified
boolean
Whether the user is verified.
id [required]
string
ID of the user.
relationships
object
Relationships of the user object returned by the API.
org
object
Relationship to an organization.
data [required]
object
Relationship to organization object.
id [required]
string
ID of the organization.
type [required]
enum
Organizations resource type.
Allowed enum values: orgs
other_orgs
object
Relationship to organizations.
data [required]
[object]
Relationships to organization objects.
id [required]
string
ID of the organization.
type [required]
enum
Organizations resource type.
Allowed enum values: orgs
other_users
object
Relationship to users.
data [required]
[object]
Relationships to user objects.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
roles
object
Relationship to roles.
data [required]
[object]
An array containing type and ID of a role.
id
string
ID of the role.
type
enum
Roles type.
Allowed enum values: roles
type [required]
enum
Users resource type.
Allowed enum values: users
{
"data": {
"attributes": {
"created": "2019-09-19T10:00:00.000Z",
"customer_impact_duration": "integer",
"customer_impact_end": "2019-09-19T10:00:00.000Z",
"customer_impact_scope": "An example customer impact scope",
"customer_impact_start": "2019-09-19T10:00:00.000Z",
"customer_impacted": false,
"detected": "2019-09-19T10:00:00.000Z",
"fields": {
"<any-key>": {}
},
"modified": "2019-09-19T10:00:00.000Z",
"notification_handles": [
"@test.user@test.com"
],
"postmortem_id": "00000000-0000-0000-0000-000000000000",
"public_id": 1,
"resolved": "2019-09-19T10:00:00.000Z",
"time_to_detect": "integer",
"time_to_internal_response": "integer",
"time_to_repair": "integer",
"time_to_resolve": "integer",
"title": "A test incident title"
},
"id": "00000000-0000-0000-0000-000000000000",
"relationships": {
"commander_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"created_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"integrations": {
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_integration_metadata"
}
]
},
"last_modified_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"postmortem": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_postmortems"
}
}
},
"type": "incidents"
},
"included": []
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Unauthorized
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X GET "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/incidents/${incident_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}"
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
if site, ok := os.LookupEnv("DD_SITE"); ok {
ctx = context.WithValue(
ctx,
datadog.ContextServerVariables,
map[string]string{"site": site},
)
}
incidentId := "incidentId_example" // string | The UUID the incident.
include := []datadog.IncidentRelatedObject{datadog.IncidentRelatedObject("users")} // []IncidentRelatedObject | Specifies which types of related objects should be included in the response. (optional)
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("GetIncident", true)
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.IncidentsApi.GetIncident(ctx, incidentId).Include(include).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.GetIncident``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `GetIncident`: IncidentResponse
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from IncidentsApi.GetIncident:\n%s\n", response_content)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.IncidentsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);
String incidentId = "incidentId_example"; // String | The UUID the incident.
List<IncidentRelatedObject> include = Arrays.asList(); // List<IncidentRelatedObject> | Specifies which types of related objects should be included in the response.
try {
IncidentResponse result = apiInstance.getIncident(incidentId)
.include(include)
.execute();
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();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import incidents_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
configuration.server_variables["site"] = os.environ["DD_SITE"]
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
configuration.unstable_operations["get_incident"] = True
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = incidents_api.IncidentsApi(api_client)
incident_id = "incident_id_example" # str | The UUID the incident.
include = [
IncidentRelatedObject("users"),
] # [IncidentRelatedObject] | Specifies which types of related objects should be included in the response. (optional)
# example passing only required values which don't have defaults set
try:
# Get the details of an incident
api_response = api_instance.get_incident(incident_id)
pprint(api_response)
except ApiException as e:
print("Exception when calling IncidentsApi->get_incident: %s\n" % e)
# example passing only required values which don't have defaults set
# and optional values
try:
# Get the details of an incident
api_response = api_instance.get_incident(incident_id, include=include)
pprint(api_response)
except ApiException as e:
print("Exception when calling IncidentsApi->get_incident: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
python3 "example.py"
require 'time'
require 'datadog_api_client'
DatadogAPIClient::V2.configure do |config|
# Defining the site is optional and defaults to datadoghq.com
config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
# setup authorization
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
config.unstable_operations[:get_incident] = true
end
api_instance = DatadogAPIClient::V2::IncidentsApi.new
incident_id = 'incident_id_example' # String | The UUID the incident.
opts = {
include: [DatadogAPIClient::V2::IncidentRelatedObject::USERS] # Array<IncidentRelatedObject> | Specifies which types of related objects should be included in the response.
}
begin
# Get the details of an incident
result = api_instance.get_incident(incident_id, opts)
p result
rescue DatadogAPIClient::V2::ApiError => e
puts "Error when calling IncidentsApi->get_incident: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
rb "example.rb"
Note: This endpoint is in public beta. If you have any feedback, contact Datadog support.
PATCH https://api.datadoghq.eu/api/v2/incidents/{incident_id}https://api.ddog-gov.com/api/v2/incidents/{incident_id}https://api.datadoghq.com/api/v2/incidents/{incident_id}https://api.us3.datadoghq.com/api/v2/incidents/{incident_id}
Updates an incident. Provide only the attributes that should be updated as this request is a partial update.
Name
Type
Description
incident_id [required]
string
The UUID the incident.
Incident Payload.
Field
Type
Description
data [required]
object
Incident data for an update request.
attributes
object
The incident's attributes for an update request.
customer_impact_end
date-time
Timestamp when customers were no longer impacted by the incident.
customer_impact_scope
string
A summary of the impact customers experienced during the incident.
customer_impact_start
date-time
Timestamp when customers began being impacted by the incident.
customer_impacted
boolean
A flag indicating whether the incident caused customer impact.
detected
date-time
Timestamp when the incident was detected.
fields
object
A condensed view of the user-defined fields for which to update selections.
<any-key>
object <oneOf>
Dynamic fields for which selections can be made, with field names as keys.
Option 1
object
A field with a single value selected.
type [required]
enum
Type of the single value field definitions.
Allowed enum values: dropdown,textbox
value
string
The single value selected for this field.
Option 2
object
A field with potentially multiple values selected.
type [required]
enum
Type of the single value field definitions.
Allowed enum values: multiselect,textarray,metrictag,autocomplete
value
[string]
The multiple values selected for this field.
notification_handles
[string]
Notification handles that will be notified of the incident during update.
resolved
date-time
Timestamp when the incident's state was set to resolved.
title
string
The title of the incident, which summarizes what happened.
id [required]
string
The team's ID.
relationships
object
The incident's relationships for an update request.
commander_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
created_by_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
integrations
object
A relationship reference for multiple integration metadata objects.
data [required]
[object]
The integration metadata relationship array
id [required]
string
A unique identifier that represents the integration metadata.
type [required]
enum
Integration metadata resource type.
Allowed enum values: incident_integration_metadata
last_modified_by_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
postmortem
object
A relationship reference for postmortems.
data [required]
object
The postmortem relationship data.
id [required]
string
A unique identifier that represents the postmortem.
type [required]
enum
Incident postmortem resource type.
Allowed enum values: incident_postmortems
type [required]
enum
Incident resource type.
Allowed enum values: incidents
{
"data": {
"attributes": {
"customer_impact_end": "2019-09-19T10:00:00.000Z",
"customer_impact_scope": "Example customer impact scope",
"customer_impact_start": "2019-09-19T10:00:00.000Z",
"customer_impacted": false,
"detected": "2019-09-19T10:00:00.000Z",
"fields": {
"<any-key>": {}
},
"notification_handles": [
"@test.user@test.com"
],
"resolved": "2019-09-19T10:00:00.000Z",
"title": "A test incident title"
},
"id": "00000000-0000-0000-0000-000000000000",
"relationships": {
"commander_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"created_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"integrations": {
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_integration_metadata"
}
]
},
"last_modified_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"postmortem": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_postmortems"
}
}
},
"type": "incidents"
}
}
OK
Response with an incident.
Field
Type
Description
data [required]
object
Incident data from a response.
attributes
object
The incident's attributes from a response.
created
date-time
Timestamp when the incident was created.
customer_impact_duration
int64
Length of the incident's customer impact in seconds.
Equals the difference between customer_impact_start
and customer_impact_end
.
customer_impact_end
date-time
Timestamp when customers were no longer impacted by the incident.
customer_impact_scope
string
A summary of the impact customers experienced during the incident.
customer_impact_start
date-time
Timestamp when customers began being impacted by the incident.
customer_impacted
boolean
A flag indicating whether the incident caused customer impact.
detected
date-time
Timestamp when the incident was detected.
fields
object
A condensed view of the user-defined fields attached to incidents.
<any-key>
object <oneOf>
Dynamic fields for which selections can be made, with field names as keys.
Option 1
object
A field with a single value selected.
type
enum
Type of the single value field definitions.
Allowed enum values: dropdown,textbox
value
string
The single value selected for this field.
Option 2
object
A field with potentially multiple values selected.
type
enum
Type of the single value field definitions.
Allowed enum values: multiselect,textarray,metrictag,autocomplete
value
[string]
The multiple values selected for this field.
modified
date-time
Timestamp when the incident was last modified.
notification_handles
[string]
Notification handles that will be notified of the incident during update.
postmortem_id
string
The UUID of the postmortem object attached to the incident.
public_id
int64
The monotonically increasing integer ID for the incident.
resolved
date-time
Timestamp when the incident's state was set to resolved.
time_to_detect
int64
The amount of time in seconds to detect the incident.
Equals the difference between customer_impact_start
and detected
.
time_to_internal_response
int64
The amount of time in seconds to call incident after detection. Equals the difference of detected
and created
.
time_to_repair
int64
The amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between customer_impact_end
and detected
.
time_to_resolve
int64
The amount of time in seconds to resolve the incident after it was created. Equals the difference between created
and resolved
.
title [required]
string
The title of the incident, which summarizes what happened.
id [required]
string
The incident's ID.
relationships
object
The incident's relationships from a response.
commander_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
created_by_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
integrations
object
A relationship reference for multiple integration metadata objects.
data [required]
[object]
The integration metadata relationship array
id [required]
string
A unique identifier that represents the integration metadata.
type [required]
enum
Integration metadata resource type.
Allowed enum values: incident_integration_metadata
last_modified_by_user
object
Relationship to user.
data [required]
object
Relationship to user object.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
postmortem
object
A relationship reference for postmortems.
data [required]
object
The postmortem relationship data.
id [required]
string
A unique identifier that represents the postmortem.
type [required]
enum
Incident postmortem resource type.
Allowed enum values: incident_postmortems
type [required]
enum
Incident resource type.
Allowed enum values: incidents
included
[object <oneOf>]
Included related resources that the user requested.
Option 1
object
User object returned by the API.
attributes
object
Attributes of user object returned by the API.
created_at
date-time
Creation time of the user.
disabled
boolean
Whether the user is disabled.
string
Email of the user.
handle
string
Handle of the user.
icon
string
URL of the user's icon.
name
string
Name of the user.
status
string
Status of the user.
title
string
Title of the user.
verified
boolean
Whether the user is verified.
id [required]
string
ID of the user.
relationships
object
Relationships of the user object returned by the API.
org
object
Relationship to an organization.
data [required]
object
Relationship to organization object.
id [required]
string
ID of the organization.
type [required]
enum
Organizations resource type.
Allowed enum values: orgs
other_orgs
object
Relationship to organizations.
data [required]
[object]
Relationships to organization objects.
id [required]
string
ID of the organization.
type [required]
enum
Organizations resource type.
Allowed enum values: orgs
other_users
object
Relationship to users.
data [required]
[object]
Relationships to user objects.
id [required]
string
A unique identifier that represents the user.
type [required]
enum
Users resource type.
Allowed enum values: users
roles
object
Relationship to roles.
data [required]
[object]
An array containing type and ID of a role.
id
string
ID of the role.
type
enum
Roles type.
Allowed enum values: roles
type [required]
enum
Users resource type.
Allowed enum values: users
{
"data": {
"attributes": {
"created": "2019-09-19T10:00:00.000Z",
"customer_impact_duration": "integer",
"customer_impact_end": "2019-09-19T10:00:00.000Z",
"customer_impact_scope": "An example customer impact scope",
"customer_impact_start": "2019-09-19T10:00:00.000Z",
"customer_impacted": false,
"detected": "2019-09-19T10:00:00.000Z",
"fields": {
"<any-key>": {}
},
"modified": "2019-09-19T10:00:00.000Z",
"notification_handles": [
"@test.user@test.com"
],
"postmortem_id": "00000000-0000-0000-0000-000000000000",
"public_id": 1,
"resolved": "2019-09-19T10:00:00.000Z",
"time_to_detect": "integer",
"time_to_internal_response": "integer",
"time_to_repair": "integer",
"time_to_resolve": "integer",
"title": "A test incident title"
},
"id": "00000000-0000-0000-0000-000000000000",
"relationships": {
"commander_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"created_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"integrations": {
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_integration_metadata"
}
]
},
"last_modified_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"postmortem": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_postmortems"
}
}
},
"type": "incidents"
},
"included": []
}
Bad Request
API error response.
{
"errors": [
"Bad Request"
]
}
Unauthorized
API error response.
{
"errors": [
"Bad Request"
]
}
Forbidden
API error response.
{
"errors": [
"Bad Request"
]
}
Not Found
API error response.
{
"errors": [
"Bad Request"
]
}
# Path parameters
export incident_id="CHANGE_ME"
# Curl command
curl -X PATCH "https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.datadoghq.com"https://api.us3.datadoghq.com/api/v2/incidents/${incident_id}" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_CLIENT_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_CLIENT_APP_KEY}" \
-d @- << EOF
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"relationships": {
"commander_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"created_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"integrations": {
"data": [
{
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_integration_metadata"
}
]
},
"last_modified_by_user": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "users"
}
},
"postmortem": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incident_postmortems"
}
}
},
"type": "incidents"
}
}
EOF
package main
import (
"context"
"encoding/json"
"fmt"
"os"
datadog "github.com/DataDog/datadog-api-client-go/api/v2/datadog"
)
func main() {
ctx := context.WithValue(
context.Background(),
datadog.ContextAPIKeys,
map[string]datadog.APIKey{
"apiKeyAuth": {
Key: os.Getenv("DD_CLIENT_API_KEY"),
},
"appKeyAuth": {
Key: os.Getenv("DD_CLIENT_APP_KEY"),
},
},
)
if site, ok := os.LookupEnv("DD_SITE"); ok {
ctx = context.WithValue(
ctx,
datadog.ContextServerVariables,
map[string]string{"site": site},
)
}
incidentId := "incidentId_example" // string | The UUID the incident.
body := *datadog.NewIncidentUpdateRequest(*datadog.NewIncidentUpdateData("00000000-0000-0000-0000-000000000000", datadog.IncidentType("incidents"))) // IncidentUpdateRequest | Incident Payload.
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("UpdateIncident", true)
api_client := datadog.NewAPIClient(configuration)
resp, r, err := api_client.IncidentsApi.UpdateIncident(ctx, incidentId).Body(body).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `IncidentsApi.UpdateIncident``: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
// response from `UpdateIncident`: IncidentResponse
response_content, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from IncidentsApi.UpdateIncident:\n%s\n", response_content)
}
First install the library and its dependencies and then save the example to main.go
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
go run "main.go"
// Import classes:
import java.util.*;
import com.datadog.api.v2.client.ApiClient;
import com.datadog.api.v2.client.ApiException;
import com.datadog.api.v2.client.Configuration;
import com.datadog.api.v2.client.auth.*;
import com.datadog.api.v2.client.model.*;
import com.datadog.api.v2.client.api.IncidentsApi;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// Configure the Datadog site to send API calls to
HashMap<String, String> serverVariables = new HashMap<String, String>();
String site = System.getenv("DD_SITE");
if (site != null) {
serverVariables.put("site", site);
defaultClient.setServerVariables(serverVariables);
}
// Configure API key authorization:
HashMap<String, String> secrets = new HashMap<String, String>();
secrets.put("apiKeyAuth", System.getenv("DD_CLIENT_API_KEY"));
secrets.put("appKeyAuth", System.getenv("DD_CLIENT_APP_KEY"));
defaultClient.configureApiKeys(secrets);
IncidentsApi apiInstance = new IncidentsApi(defaultClient);
String incidentId = "incidentId_example"; // String | The UUID the incident.
IncidentUpdateRequest body = new IncidentUpdateRequest(); // IncidentUpdateRequest | Incident Payload.
try {
IncidentResponse result = apiInstance.updateIncident(incidentId)
.body(body)
.execute();
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();
}
}
}
First install the library and its dependencies and then save the example to Example.java
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
java "Example.java"
import os
from dateutil.parser import parse as dateutil_parser
from datadog_api_client.v2 import ApiClient, ApiException, Configuration
from datadog_api_client.v2.api import incidents_api
from datadog_api_client.v2.models import *
from pprint import pprint
# See configuration.py for a list of all supported configuration parameters.
configuration = Configuration()
# Defining the site is optional and defaults to datadoghq.com
if "DD_SITE" in os.environ:
configuration.server_variables["site"] = os.environ["DD_SITE"]
# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.getenv('DD_CLIENT_API_KEY')
# Configure API key authorization: appKeyAuth
configuration.api_key['appKeyAuth'] = os.getenv('DD_CLIENT_APP_KEY')
configuration.unstable_operations["update_incident"] = True
# Enter a context with an instance of the API client
with ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = incidents_api.IncidentsApi(api_client)
incident_id = "incident_id_example" # str | The UUID the incident.
body = IncidentUpdateRequest(
data=IncidentUpdateData(
attributes=IncidentUpdateAttributes(
customer_impact_end=dateutil_parser('1970-01-01T00:00:00.00Z'),
customer_impact_scope="Example customer impact scope",
customer_impact_start=dateutil_parser('1970-01-01T00:00:00.00Z'),
customer_impacted=False,
detected=dateutil_parser('1970-01-01T00:00:00.00Z'),
fields={
"key": IncidentFieldAttributes(),
},
notification_handles=[
"@test.user@test.com",
],
resolved=dateutil_parser('1970-01-01T00:00:00.00Z'),
title="A test incident title",
),
id="00000000-0000-0000-0000-000000000000",
relationships=IncidentUpdateRelationships(
commander_user=RelationshipToUser(
data=RelationshipToUserData(
id="00000000-0000-0000-0000-000000000000",
type=UsersType("users"),
),
),
created_by_user=RelationshipToUser(
data=RelationshipToUserData(
id="00000000-0000-0000-0000-000000000000",
type=UsersType("users"),
),
),
integrations=RelationshipToIncidentIntegrationMetadatas(
data=[{"id":"00000000-0000-0000-0000-000000000000","type":"incident_integration_metadata"},{"id":"00000000-0000-0000-0000-000000000000","type":"incident_integration_metadata"}],
),
last_modified_by_user=RelationshipToUser(
data=RelationshipToUserData(
id="00000000-0000-0000-0000-000000000000",
type=UsersType("users"),
),
),
postmortem=RelationshipToIncidentPostmortem(
data=RelationshipToIncidentPostmortemData(
id="00000000-0000-0000-0000-000000000000",
type=IncidentPostmortemType("incident_postmortems"),
),
),
),
type=IncidentType("incidents"),
),
) # IncidentUpdateRequest | Incident Payload.
# example passing only required values which don't have defaults set
try:
# Update an existing incident
api_response = api_instance.update_incident(incident_id, body)
pprint(api_response)
except ApiException as e:
print("Exception when calling IncidentsApi->update_incident: %s\n" % e)
First install the library and its dependencies and then save the example to example.py
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
python3 "example.py"
require 'time'
require 'datadog_api_client'
DatadogAPIClient::V2.configure do |config|
# Defining the site is optional and defaults to datadoghq.com
config.server_variables['site'] = ENV["DD_SITE"] if ENV.key? 'DD_SITE'
# setup authorization
# Configure API key authorization: apiKeyAuth
config.api_key['apiKeyAuth'] = ENV["DD_CLIENT_API_KEY"]
# Configure API key authorization: appKeyAuth
config.api_key['appKeyAuth'] = ENV["DD_CLIENT_APP_KEY"]
config.unstable_operations[:update_incident] = true
end
api_instance = DatadogAPIClient::V2::IncidentsApi.new
incident_id = 'incident_id_example' # String | The UUID the incident.
body = DatadogAPIClient::V2::IncidentUpdateRequest.new({data: DatadogAPIClient::V2::IncidentUpdateData.new({id: '00000000-0000-0000-0000-000000000000', type: DatadogAPIClient::V2::IncidentType::INCIDENTS})}) # IncidentUpdateRequest | Incident Payload.
begin
# Update an existing incident
result = api_instance.update_incident(incident_id, body)
p result
rescue DatadogAPIClient::V2::ApiError => e
puts "Error when calling IncidentsApi->update_incident: #{e}"
end
First install the library and its dependencies and then save the example to example.rb
and run following commands:
export DD_SITE="datadoghq.comus3.datadoghq.comdatadoghq.euddog-gov.com"
rb "example.rb"