Rechercher des incidents
https://api.datadoghq.com/api/v2/incidents/searchhttps://api.us3.datadoghq.com/api/v2/incidents/searchhttps://api.us5.datadoghq.com/api/v2/incidents/searchhttps://api.datadoghq.eu/api/v2/incidents/searchhttps://api.ap1.datadoghq.com/api/v2/incidents/searchhttps://api.ap2.datadoghq.com/api/v2/incidents/searchhttps://api.uk1.datadoghq.com/api/v2/incidents/searchhttps://api.ddog-gov.com/api/v2/incidents/searchhttps://api.us2.ddog-gov.com/api/v2/incidents/searchPrésentation
Recherchez des incidents correspondant à une certaine requête.
OAuth apps require the incident_read authorization scope to access this endpoint.
Arguments
Chaînes de requête
includeSpecifies which types of related objects should be included in the response.
users, attachmentsquery [required]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).
sortSpecifies the order of returned incidents.
created, -createdpage[size]Number of items to return per page. The maximum allowed value is 100.
10page[offset]Specific offset to use as the beginning of the returned page.
0Réponse
OK
Response with incidents and facets.
data [required]Data returned by an incident search.
attributesAttributes returned by an incident search.
facets [required]Facet data for incidents returned by a search query.
commanderFacet data for incident commander users.
countCount of the facet value appearing in search results.
emailEmail of the user.
handleHandle of the user.
nameName of the user.
uuidID of the user.
created_byFacet data for incident creator users.
countCount of the facet value appearing in search results.
emailEmail of the user.
handleHandle of the user.
nameName of the user.
uuidID of the user.
fieldsFacet data for incident property fields.
aggregatesAggregate information for numeric incident data.
maxMaximum value of the numeric aggregates.
minMinimum value of the numeric aggregates.
facets [required]Facet data for the property field of an incident.
countCount of the facet value appearing in search results.
nameThe facet value appearing in search results.
name [required]Name of the incident property field.
impactFacet data for incident impact attributes.
countCount of the facet value appearing in search results.
nameThe facet value appearing in search results.
last_modified_byFacet data for incident last modified by users.
countCount of the facet value appearing in search results.
emailEmail of the user.
handleHandle of the user.
nameName of the user.
uuidID of the user.
postmortemFacet data for incident postmortem existence.
countCount of the facet value appearing in search results.
nameThe facet value appearing in search results.
responderFacet data for incident responder users.
countCount of the facet value appearing in search results.
emailEmail of the user.
handleHandle of the user.
nameName of the user.
uuidID of the user.
severityFacet data for incident severity attributes.
countCount of the facet value appearing in search results.
nameThe facet value appearing in search results.
stateFacet data for incident state attributes.
countCount of the facet value appearing in search results.
nameThe facet value appearing in search results.
time_to_repairFacet data for incident time to repair metrics.
aggregates [required]Aggregate information for numeric incident data.
maxMaximum value of the numeric aggregates.
minMinimum value of the numeric aggregates.
name [required]Name of the incident property field.
time_to_resolveFacet data for incident time to resolve metrics.
aggregates [required]Aggregate information for numeric incident data.
maxMaximum value of the numeric aggregates.
minMinimum value of the numeric aggregates.
name [required]Name of the incident property field.
incidents [required]Incidents returned by the search.
data [required]Incident data from a response.
attributesThe incident's attributes from a response.
archivedTimestamp of when the incident was archived.
case_idThe incident case id.
createdTimestamp when the incident was created.
customer_impact_durationLength of the incident's customer impact in seconds.
Equals the difference between customer_impact_start and customer_impact_end.
customer_impact_endTimestamp when customers were no longer impacted by the incident.
customer_impact_scopeA summary of the impact customers experienced during the incident.
customer_impact_startTimestamp when customers began being impacted by the incident.
customer_impactedA flag indicating whether the incident caused customer impact.
declaredTimestamp when the incident was declared.
declared_byIncident's non Datadog creator.
image_48_pxNon Datadog creator 48px image.
nameNon Datadog creator name.
declared_by_uuidUUID of the user who declared the incident.
detectedTimestamp when the incident was detected.
fieldsA condensed view of the user-defined fields attached to incidents.
<any-key>Dynamic fields for which selections can be made, with field names as keys.
Object 1A field with a single value selected.
typeType of the single value field definitions.
dropdowndropdown, textboxvalueThe single value selected for this field.
Object 2A field with potentially multiple values selected.
typeType of the multiple value field definitions.
multiselectmultiselect, textarray, metrictag, autocompletevalueThe multiple values selected for this field.
incident_type_uuidA unique identifier that represents an incident type.
is_testA flag indicating whether the incident is a test incident.
modifiedTimestamp when the incident was last modified.
non_datadog_creatorIncident's non Datadog creator.
image_48_pxNon Datadog creator 48px image.
nameNon Datadog creator name.
notification_handlesNotification handles that will be notified of the incident during update.
display_nameThe name of the notified handle.
handleThe handle used for the notification. This includes an email address, Slack channel, or workflow.
public_idThe monotonically increasing integer ID for the incident.
resolvedTimestamp when the incident's state was last changed from active or stable to resolved or completed.
severityThe incident severity.
UNKNOWN, SEV-0, SEV-1, SEV-2, SEV-3, SEV-4, SEV-5stateThe state incident.
time_to_detectThe amount of time in seconds to detect the incident.
Equals the difference between customer_impact_start and detected.
time_to_internal_responseThe amount of time in seconds to call incident after detection. Equals the difference of detected and created.
time_to_repairThe amount of time in seconds to resolve customer impact after detecting the issue. Equals the difference between customer_impact_end and detected.
time_to_resolveThe amount of time in seconds to resolve the incident after it was created. Equals the difference between created and resolved.
title [required]The title of the incident, which summarizes what happened.
visibilityThe incident visibility status.
id [required]The incident's ID.
relationshipsThe incident's relationships from a response.
attachmentsA relationship reference for attachments.
data [required]An array of incident attachments.
id [required]A unique identifier that represents the attachment.
type [required]The incident attachment resource type.
incident_attachmentsincident_attachmentscommander_userRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]Users resource type.
usersuserscreated_by_userRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]Users resource type.
usersusersdeclared_by_userRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]Users resource type.
usersusersimpactsRelationship to impacts.
data [required]An array of incident impacts.
id [required]A unique identifier that represents the impact.
type [required]The incident impacts type.
incident_impactsintegrationsA relationship reference for multiple integration metadata objects.
data [required]Integration metadata relationship array
id [required]A unique identifier that represents the integration metadata.
type [required]Integration metadata resource type.
incident_integrationsincident_integrationslast_modified_by_userRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]Users resource type.
usersusersrespondersRelationship to incident responders.
data [required]An array of incident responders.
id [required]A unique identifier that represents the responder.
type [required]The incident responders type.
incident_respondersuser_defined_fieldsRelationship to incident user defined fields.
data [required]An array of user defined fields.
id [required]A unique identifier that represents the responder.
type [required]The incident user defined fields type.
user_defined_fieldtype [required]Incident resource type.
incidentsincidentstotal [required]Number of incidents returned by the search.
typeIncident search result type.
incidents_search_resultsincidents_search_resultsincludedIncluded related resources that the user requested.
<type=users>User object returned by the API.
attributesAttributes of user object returned by the API.
emailEmail of the user.
handleHandle of the user.
iconURL of the user's icon.
nameName of the user.
uuidUUID of the user.
idID of the user.
typeUsers resource type.
usersusers<type=incident_attachments>Attachment data from a response.
attributes [required]The attachment's attributes.
attachmentThe attachment object.
documentUrlThe URL of the attachment.
titleThe title of the attachment.
attachment_typeThe type of the attachment.
postmortem, linkmodifiedTimestamp when the attachment was last modified.
id [required]The unique identifier of the attachment.
relationships [required]The attachment's resource relationships.
incidentRelationship to incident.
data [required]Relationship to incident object.
id [required]A unique identifier that represents the incident.
type [required]Incident resource type.
incidentsincidentslast_modified_by_userRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]Users resource type.
usersuserstype [required]The incident attachment resource type.
incident_attachmentsincident_attachmentsmetaThe metadata object containing pagination metadata.
paginationPagination properties.
next_offsetThe index of the first element in the next page of results. Equal to page size added to the current offset.
offsetThe index of the first element in the results.
sizeMaximum 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,
"declared": "2019-09-19T10:00:00.000Z",
"declared_by": {
"image_48_px": "string",
"name": "string"
},
"declared_by_uuid": "string",
"detected": "2019-09-19T10:00:00.000Z",
"fields": {
"<any-key>": "undefined"
},
"incident_type_uuid": "00000000-0000-0000-0000-000000000000",
"is_test": false,
"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"
}
},
"declared_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": {
"email": "string",
"handle": "string",
"icon": "string",
"name": "string",
"uuid": "string"
},
"id": "string",
"type": "users"
}
],
"meta": {
"pagination": {
"next_offset": 1000,
"offset": 10,
"size": 1000
}
}
}Bad Request
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Unauthorized
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Forbidden
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Not Found
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Exemple de code
# Required query arguments
export query="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/incidents/search?query=${query}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Required query arguments
export query="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/incidents/search?query=${query}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Required query arguments
export query="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/incidents/search?query=${query}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Required query arguments
export query="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/incidents/search?query=${query}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Required query arguments
export query="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/incidents/search?query=${query}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Required query arguments
export query="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/incidents/search?query=${query}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Required query arguments
export query="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/incidents/search?query=${query}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Required query arguments
export query="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/incidents/search?query=${query}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Required query arguments
export query="CHANGE_ME"
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/incidents/search?query=${query}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"// 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())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" 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.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
Search for incidents returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.incidents_api import IncidentsApi
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# Search for incidents returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// Search for incidents returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_incidents::IncidentsAPI;
use datadog_api_client::datadogV2::api_incidents::SearchIncidentsOptionalParams;
#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.search_incidents", true);
let api = IncidentsAPI::with_config(configuration);
let resp = api
.search_incidents(
"state:(active OR stable OR resolved)".to_string(),
SearchIncidentsOptionalParams::default(),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run/**
* Search for incidents returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
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.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"