Link incident to work item
https://api.datadoghq.com/api/v2/cases/{case_id}/relationships/incidentshttps://api.us3.datadoghq.com/api/v2/cases/{case_id}/relationships/incidentshttps://api.us5.datadoghq.com/api/v2/cases/{case_id}/relationships/incidentshttps://api.datadoghq.eu/api/v2/cases/{case_id}/relationships/incidentshttps://api.ap1.datadoghq.com/api/v2/cases/{case_id}/relationships/incidentshttps://api.ap2.datadoghq.com/api/v2/cases/{case_id}/relationships/incidentshttps://api.uk1.datadoghq.com/api/v2/cases/{case_id}/relationships/incidentshttps://api.ddog-gov.com/api/v2/cases/{case_id}/relationships/incidentshttps://api.us2.ddog-gov.com/api/v2/cases/{case_id}/relationships/incidents概要
Link an incident to a work item
OAuth apps require the cases_write authorization scope to access this endpoint.
引数
パスパラメーター
case_id [required]Work item's UUID or key
リクエスト
Body Data (required)
Incident link request
data [required]Incident relationship data
id [required]Incident identifier
type [required]Incident resource type
incidents{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incidents"
}
}応答
Created
Work item response
dataA work item
attributes [required]Work item resource attributes
archived_atTimestamp of when the work item was archived
attributesKey-value pairs of work item attributes. Each key maps to an array of string values, used for flexible metadata such as labels or tags.
<any-key>closed_atTimestamp of when the work item was closed
created_atTimestamp of when the work item was created
custom_attributesWork item custom attributes
<any-key>A typed value for a custom attribute on a specific work item.
is_multi [required]If true, value must be an array
type [required]The data type of the custom attribute, which determines the allowed values and UI input control.
URL, TEXT, NUMBER, SELECTvalue [required]The value of a custom attribute. The accepted format depends on the attribute's type and whether it accepts multiple values.
Object 1A string value for a TEXT, URL, or SELECT-type custom attribute.
Object 2An array of string values for a multi-value TEXT, URL, or SELECT-type custom attribute.
Object 3A numeric value for a NUMBER-type custom attribute.
Object 4An array of numeric values for a multi-value NUMBER-type custom attribute.
descriptionDescription
jira_issueJira issue attached to work item
resultJira issue information
issue_idJira issue ID
issue_keyJira issue key
issue_urlJira issue URL
project_keyJira project key
statusWork item status
IN_PROGRESSIN_PROGRESS, COMPLETED, FAILEDkeyKey
modified_atTimestamp of when the work item was last modified
priorityWork item priority
NOT_DEFINEDNOT_DEFINED, P1, P2, P3, P4, P5service_now_ticketServiceNow ticket attached to work item
resultServiceNow ticket information
sys_target_linkLink to the Incident created on ServiceNow
statusWork item status
IN_PROGRESSIN_PROGRESS, COMPLETED, FAILEDstatusDEPRECATED Deprecated way of representing the work item status, which only supports OPEN, IN_PROGRESS, and CLOSED statuses. Use status_name instead.
OPEN, IN_PROGRESS, CLOSEDstatus_groupStatus group of the work item.
SG_OPEN, SG_IN_PROGRESS, SG_CLOSEDstatus_nameStatus of the work item. Must be one of the existing statuses for the work item's type.
titleTitle
typeDEPRECATED Work item type
STANDARDtype_idWork item type UUID
id [required]Work item's identifier
relationshipsResources related to a work item
assigneeRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]User resource type.
userusercreated_byRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]User resource type.
userusermodified_byRelationship to user.
data [required]Relationship to user object.
id [required]A unique identifier that represents the user.
type [required]User resource type.
useruserprojectRelationship to project.
data [required]Relationship to project object.
id [required]A unique identifier that represents the project.
type [required]Project resource type.
projectprojecttype [required]JSON:API resource type for work items.
casecase{
"data": {
"attributes": {
"archived_at": "2019-09-19T10:00:00.000Z",
"attributes": {
"<any-key>": []
},
"closed_at": "2019-09-19T10:00:00.000Z",
"created_at": "2019-09-19T10:00:00.000Z",
"custom_attributes": {
"<any-key>": {
"is_multi": false,
"type": "NUMBER",
"value": {
"description": "",
"type": ""
}
}
},
"description": "string",
"jira_issue": {
"result": {
"issue_id": "string",
"issue_key": "string",
"issue_url": "string",
"project_key": "string"
},
"status": "COMPLETED"
},
"key": "CASEM-4523",
"modified_at": "2019-09-19T10:00:00.000Z",
"priority": "NOT_DEFINED",
"service_now_ticket": {
"result": {
"sys_target_link": "string"
},
"status": "COMPLETED"
},
"status": "OPEN",
"status_group": "SG_OPEN",
"status_name": "Open",
"title": "Memory leak investigation on API",
"type": "STANDARD",
"type_id": "3b010bde-09ce-4449-b745-71dd5f861963"
},
"id": "aeadc05e-98a8-11ec-ac2c-da7ad0900001",
"relationships": {
"assignee": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "user"
}
},
"created_by": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "user"
}
},
"modified_by": {
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "user"
}
},
"project": {
"data": {
"id": "e555e290-ed65-49bd-ae18-8acbfcf18db7",
"type": "project"
}
}
},
"type": "case"
}
}Bad Request
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Unauthorized
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Forbidden
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Not Found
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}コード例
# Path parameters
export case_id="f98a5a5b-e0ff-45d4-b2f5-afe6e74de504"
# 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 POST "https://api.${DD_SITE}/api/v2/cases/${case_id}/relationships/incidents" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incidents"
}
}
EOF# Path parameters
export case_id="f98a5a5b-e0ff-45d4-b2f5-afe6e74de504"
# 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 POST "https://api.${DD_SITE}/api/v2/cases/${case_id}/relationships/incidents" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incidents"
}
}
EOF# Path parameters
export case_id="f98a5a5b-e0ff-45d4-b2f5-afe6e74de504"
# 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 POST "https://api.${DD_SITE}/api/v2/cases/${case_id}/relationships/incidents" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incidents"
}
}
EOF# Path parameters
export case_id="f98a5a5b-e0ff-45d4-b2f5-afe6e74de504"
# 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 POST "https://api.${DD_SITE}/api/v2/cases/${case_id}/relationships/incidents" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incidents"
}
}
EOF# Path parameters
export case_id="f98a5a5b-e0ff-45d4-b2f5-afe6e74de504"
# 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 POST "https://api.${DD_SITE}/api/v2/cases/${case_id}/relationships/incidents" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incidents"
}
}
EOF# Path parameters
export case_id="f98a5a5b-e0ff-45d4-b2f5-afe6e74de504"
# 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 POST "https://api.${DD_SITE}/api/v2/cases/${case_id}/relationships/incidents" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incidents"
}
}
EOF# Path parameters
export case_id="f98a5a5b-e0ff-45d4-b2f5-afe6e74de504"
# 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 POST "https://api.${DD_SITE}/api/v2/cases/${case_id}/relationships/incidents" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incidents"
}
}
EOF# Path parameters
export case_id="f98a5a5b-e0ff-45d4-b2f5-afe6e74de504"
# 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 POST "https://api.${DD_SITE}/api/v2/cases/${case_id}/relationships/incidents" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incidents"
}
}
EOF# Path parameters
export case_id="f98a5a5b-e0ff-45d4-b2f5-afe6e74de504"
# 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 POST "https://api.${DD_SITE}/api/v2/cases/${case_id}/relationships/incidents" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "incidents"
}
}
EOF// Link incident to case returns "Created" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
body := datadogV2.RelationshipToIncidentRequest{
Data: datadogV2.IncidentRelationshipData{
Id: "00000000-0000-0000-0000-000000000000",
Type: datadogV2.INCIDENTRESOURCETYPE_INCIDENTS,
},
}
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewCaseManagementApi(apiClient)
resp, r, err := api.LinkIncident(ctx, "case_id", body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `CaseManagementApi.LinkIncident`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `CaseManagementApi.LinkIncident`:\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"// Link incident to case returns "Created" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.CaseManagementApi;
import com.datadog.api.client.v2.model.CaseResponse;
import com.datadog.api.client.v2.model.IncidentRelationshipData;
import com.datadog.api.client.v2.model.IncidentResourceType;
import com.datadog.api.client.v2.model.RelationshipToIncidentRequest;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
CaseManagementApi apiInstance = new CaseManagementApi(defaultClient);
RelationshipToIncidentRequest body =
new RelationshipToIncidentRequest()
.data(
new IncidentRelationshipData()
.id("00000000-0000-0000-0000-000000000000")
.type(IncidentResourceType.INCIDENTS));
try {
CaseResponse result = apiInstance.linkIncident("f98a5a5b-e0ff-45d4-b2f5-afe6e74de504", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CaseManagementApi#linkIncident");
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""""
Link incident to case returns "Created" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.case_management_api import CaseManagementApi
from datadog_api_client.v2.model.incident_relationship_data import IncidentRelationshipData
from datadog_api_client.v2.model.incident_resource_type import IncidentResourceType
from datadog_api_client.v2.model.relationship_to_incident_request import RelationshipToIncidentRequest
body = RelationshipToIncidentRequest(
data=IncidentRelationshipData(
id="00000000-0000-0000-0000-000000000000",
type=IncidentResourceType.INCIDENTS,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = CaseManagementApi(api_client)
response = api_instance.link_incident(case_id="case_id", body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.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"# Link incident to case returns "Created" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::CaseManagementAPI.new
body = DatadogAPIClient::V2::RelationshipToIncidentRequest.new({
data: DatadogAPIClient::V2::IncidentRelationshipData.new({
id: "00000000-0000-0000-0000-000000000000",
type: DatadogAPIClient::V2::IncidentResourceType::INCIDENTS,
}),
})
p api_instance.link_incident("case_id", body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.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"// Link incident to case returns "Created" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_case_management::CaseManagementAPI;
use datadog_api_client::datadogV2::model::IncidentRelationshipData;
use datadog_api_client::datadogV2::model::IncidentResourceType;
use datadog_api_client::datadogV2::model::RelationshipToIncidentRequest;
#[tokio::main]
async fn main() {
let body = RelationshipToIncidentRequest::new(IncidentRelationshipData::new(
"00000000-0000-0000-0000-000000000000".to_string(),
IncidentResourceType::INCIDENTS,
));
let configuration = datadog::Configuration::new();
let api = CaseManagementAPI::with_config(configuration);
let resp = api.link_incident("case_id".to_string(), body).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/**
* Link incident to case returns "Created" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
const apiInstance = new v2.CaseManagementApi(configuration);
const params: v2.CaseManagementApiLinkIncidentRequest = {
body: {
data: {
id: "00000000-0000-0000-0000-000000000000",
type: "incidents",
},
},
caseId: "case_id",
};
apiInstance
.linkIncident(params)
.then((data: v2.CaseResponse) => {
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"