Update a Salesforce incident template
https://api.datadoghq.com/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}https://api.us3.datadoghq.com/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}https://api.us5.datadoghq.com/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}https://api.datadoghq.eu/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}https://api.ap1.datadoghq.com/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}https://api.ap2.datadoghq.com/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}https://api.uk1.datadoghq.com/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}https://api.ddog-gov.com/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}https://api.us2.ddog-gov.com/api/v2/integration/salesforce-incidents/incident-templates/{incident_template_id}Présentation
Update a single Salesforce incident template in your organization.
Arguments
Paramètres du chemin
incident_template_id [required]The ID of the Salesforce incident template.
Requête
Body Data (required)
Salesforce incident template payload.
data [required]Salesforce incident template data for an update request.
attributes [required]Salesforce incident template attributes for an update request.
descriptionLong-form description body for Salesforce incidents created from this template.
nameHuman-readable name for this incident template.
owner_idThe Salesforce user ID that owns incidents created from this template.
priorityPriority of the Salesforce incident created from this template.
Critical, High, Moderate, Lowsalesforce_org_idThe Datadog-assigned ID of the Salesforce organization this template belongs to.
subjectSubject line for Salesforce incidents created from this template.
id [required]The ID of the Salesforce incident template being updated. Must match the path parameter.
type [required]Salesforce incident template resource type.
salesforce-incidents-incident-templatesalesforce-incidents-incident-template{
"data": {
"attributes": {
"description": "An incident was detected by Datadog monitors.",
"name": "production-outage",
"owner_id": "005000000000000",
"priority": "High",
"salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3",
"subject": "Datadog Incident: Production Outage"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}Réponse
OK
Response containing a Salesforce incident template.
data [required]Salesforce incident template data from a response.
attributes [required]Salesforce incident template attributes returned by the API.
descriptionLong-form description body for Salesforce incidents created from this template.
nameHuman-readable name for this incident template.
owner_idThe Salesforce user ID that owns incidents created from this template.
priorityPriority of the Salesforce incident created from this template.
Critical, High, Moderate, Lowsalesforce_org_idThe Datadog-assigned ID of the Salesforce organization this template belongs to.
subjectSubject line for Salesforce incidents created from this template.
id [required]The ID of the Salesforce incident template.
type [required]Salesforce incident template resource type.
salesforce-incidents-incident-templatesalesforce-incidents-incident-template{
"data": {
"attributes": {
"description": "An incident was detected by Datadog monitors.",
"name": "production-outage",
"owner_id": "005000000000000",
"priority": "High",
"salesforce_org_id": "596da4af-0563-4097-90ff-07230c3f9db3",
"subject": "Datadog Incident: Production Outage"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}Bad Request
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"
]
}Conflict
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
# Path parameters
export incident_template_id="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 PATCH "https://api.${DD_SITE}/api/v2/integration/salesforce-incidents/incident-templates/${incident_template_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "production-outage-renamed"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}
EOF# Path parameters
export incident_template_id="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 PATCH "https://api.${DD_SITE}/api/v2/integration/salesforce-incidents/incident-templates/${incident_template_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "production-outage-renamed"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}
EOF# Path parameters
export incident_template_id="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 PATCH "https://api.${DD_SITE}/api/v2/integration/salesforce-incidents/incident-templates/${incident_template_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "production-outage-renamed"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}
EOF# Path parameters
export incident_template_id="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 PATCH "https://api.${DD_SITE}/api/v2/integration/salesforce-incidents/incident-templates/${incident_template_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "production-outage-renamed"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}
EOF# Path parameters
export incident_template_id="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 PATCH "https://api.${DD_SITE}/api/v2/integration/salesforce-incidents/incident-templates/${incident_template_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "production-outage-renamed"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}
EOF# Path parameters
export incident_template_id="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 PATCH "https://api.${DD_SITE}/api/v2/integration/salesforce-incidents/incident-templates/${incident_template_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "production-outage-renamed"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}
EOF# Path parameters
export incident_template_id="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 PATCH "https://api.${DD_SITE}/api/v2/integration/salesforce-incidents/incident-templates/${incident_template_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "production-outage-renamed"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}
EOF# Path parameters
export incident_template_id="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 PATCH "https://api.${DD_SITE}/api/v2/integration/salesforce-incidents/incident-templates/${incident_template_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "production-outage-renamed"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}
EOF# Path parameters
export incident_template_id="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 PATCH "https://api.${DD_SITE}/api/v2/integration/salesforce-incidents/incident-templates/${incident_template_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "production-outage-renamed"
},
"id": "596da4af-0563-4097-90ff-07230c3f9db3",
"type": "salesforce-incidents-incident-template"
}
}
EOF// Update a Salesforce incident template 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"
"github.com/google/uuid"
)
func main() {
body := datadogV2.SalesforceIncidentsTemplateUpdateRequest{
Data: datadogV2.SalesforceIncidentsTemplateUpdateData{
Attributes: datadogV2.SalesforceIncidentsTemplateUpdateAttributes{
Description: datadog.PtrString("An incident was detected by Datadog monitors."),
Name: datadog.PtrString("production-outage"),
OwnerId: datadog.PtrString("005000000000000"),
Priority: datadogV2.SALESFORCEINCIDENTSTEMPLATEPRIORITY_HIGH.Ptr(),
SalesforceOrgId: datadog.PtrUUID(uuid.MustParse("596da4af-0563-4097-90ff-07230c3f9db3")),
Subject: datadog.PtrString("Datadog Incident: Production Outage"),
},
Id: "596da4af-0563-4097-90ff-07230c3f9db3",
Type: datadogV2.SALESFORCEINCIDENTSTEMPLATETYPE_SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE,
},
}
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.NewSalesforceIntegrationApi(apiClient)
resp, r, err := api.UpdateIncidentTemplate(ctx, "incident_template_id", body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SalesforceIntegrationApi.UpdateIncidentTemplate`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `SalesforceIntegrationApi.UpdateIncidentTemplate`:\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"// Update a Salesforce incident template returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SalesforceIntegrationApi;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplatePriority;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplateResponse;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplateType;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplateUpdateAttributes;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplateUpdateData;
import com.datadog.api.client.v2.model.SalesforceIncidentsTemplateUpdateRequest;
import java.util.UUID;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
SalesforceIntegrationApi apiInstance = new SalesforceIntegrationApi(defaultClient);
SalesforceIncidentsTemplateUpdateRequest body =
new SalesforceIncidentsTemplateUpdateRequest()
.data(
new SalesforceIncidentsTemplateUpdateData()
.attributes(
new SalesforceIncidentsTemplateUpdateAttributes()
.description("An incident was detected by Datadog monitors.")
.name("production-outage")
.ownerId("005000000000000")
.priority(SalesforceIncidentsTemplatePriority.HIGH)
.salesforceOrgId(
UUID.fromString("596da4af-0563-4097-90ff-07230c3f9db3"))
.subject("Datadog Incident: Production Outage"))
.id("596da4af-0563-4097-90ff-07230c3f9db3")
.type(SalesforceIncidentsTemplateType.SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE));
try {
SalesforceIncidentsTemplateResponse result =
apiInstance.updateIncidentTemplate("incident_template_id", body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SalesforceIntegrationApi#updateIncidentTemplate");
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""""
Update a Salesforce incident template returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.salesforce_integration_api import SalesforceIntegrationApi
from datadog_api_client.v2.model.salesforce_incidents_template_priority import SalesforceIncidentsTemplatePriority
from datadog_api_client.v2.model.salesforce_incidents_template_type import SalesforceIncidentsTemplateType
from datadog_api_client.v2.model.salesforce_incidents_template_update_attributes import (
SalesforceIncidentsTemplateUpdateAttributes,
)
from datadog_api_client.v2.model.salesforce_incidents_template_update_data import SalesforceIncidentsTemplateUpdateData
from datadog_api_client.v2.model.salesforce_incidents_template_update_request import (
SalesforceIncidentsTemplateUpdateRequest,
)
from uuid import UUID
body = SalesforceIncidentsTemplateUpdateRequest(
data=SalesforceIncidentsTemplateUpdateData(
attributes=SalesforceIncidentsTemplateUpdateAttributes(
description="An incident was detected by Datadog monitors.",
name="production-outage",
owner_id="005000000000000",
priority=SalesforceIncidentsTemplatePriority.HIGH,
salesforce_org_id=UUID("596da4af-0563-4097-90ff-07230c3f9db3"),
subject="Datadog Incident: Production Outage",
),
id="596da4af-0563-4097-90ff-07230c3f9db3",
type=SalesforceIncidentsTemplateType.SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = SalesforceIntegrationApi(api_client)
response = api_instance.update_incident_template(incident_template_id="incident_template_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"# Update a Salesforce incident template returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::SalesforceIntegrationAPI.new
body = DatadogAPIClient::V2::SalesforceIncidentsTemplateUpdateRequest.new({
data: DatadogAPIClient::V2::SalesforceIncidentsTemplateUpdateData.new({
attributes: DatadogAPIClient::V2::SalesforceIncidentsTemplateUpdateAttributes.new({
description: "An incident was detected by Datadog monitors.",
name: "production-outage",
owner_id: "005000000000000",
priority: DatadogAPIClient::V2::SalesforceIncidentsTemplatePriority::HIGH,
salesforce_org_id: "596da4af-0563-4097-90ff-07230c3f9db3",
subject: "Datadog Incident: Production Outage",
}),
id: "596da4af-0563-4097-90ff-07230c3f9db3",
type: DatadogAPIClient::V2::SalesforceIncidentsTemplateType::SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE,
}),
})
p api_instance.update_incident_template("incident_template_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"// Update a Salesforce incident template returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_salesforce_integration::SalesforceIntegrationAPI;
use datadog_api_client::datadogV2::model::SalesforceIncidentsTemplatePriority;
use datadog_api_client::datadogV2::model::SalesforceIncidentsTemplateType;
use datadog_api_client::datadogV2::model::SalesforceIncidentsTemplateUpdateAttributes;
use datadog_api_client::datadogV2::model::SalesforceIncidentsTemplateUpdateData;
use datadog_api_client::datadogV2::model::SalesforceIncidentsTemplateUpdateRequest;
use uuid::Uuid;
#[tokio::main]
async fn main() {
let body =
SalesforceIncidentsTemplateUpdateRequest::new(SalesforceIncidentsTemplateUpdateData::new(
SalesforceIncidentsTemplateUpdateAttributes::new()
.description("An incident was detected by Datadog monitors.".to_string())
.name("production-outage".to_string())
.owner_id("005000000000000".to_string())
.priority(SalesforceIncidentsTemplatePriority::HIGH)
.salesforce_org_id(
Uuid::parse_str("596da4af-0563-4097-90ff-07230c3f9db3").expect("invalid UUID"),
)
.subject("Datadog Incident: Production Outage".to_string()),
"596da4af-0563-4097-90ff-07230c3f9db3".to_string(),
SalesforceIncidentsTemplateType::SALESFORCE_INCIDENTS_INCIDENT_TEMPLATE,
));
let configuration = datadog::Configuration::new();
let api = SalesforceIntegrationAPI::with_config(configuration);
let resp = api
.update_incident_template("incident_template_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="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run/**
* Update a Salesforce incident template 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,
},
},
});
const apiInstance = new v2.SalesforceIntegrationApi(configuration);
const params: v2.SalesforceIntegrationApiUpdateIncidentTemplateRequest = {
body: {
data: {
attributes: {
description: "An incident was detected by Datadog monitors.",
name: "production-outage",
ownerId: "005000000000000",
priority: "High",
salesforceOrgId: "596da4af-0563-4097-90ff-07230c3f9db3",
subject: "Datadog Incident: Production Outage",
},
id: "596da4af-0563-4097-90ff-07230c3f9db3",
type: "salesforce-incidents-incident-template",
},
},
incidentTemplateId: "incident_template_id",
};
apiInstance
.updateIncidentTemplate(params)
.then((data: v2.SalesforceIncidentsTemplateResponse) => {
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"