Update On-Call escalation policy
https://api.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}https://api.us3.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}https://api.us5.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}https://api.datadoghq.eu/api/v2/on-call/escalation-policies/{policy_id}https://api.ap1.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}https://api.ap2.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}https://api.uk1.datadoghq.com/api/v2/on-call/escalation-policies/{policy_id}https://api.ddog-gov.com/api/v2/on-call/escalation-policies/{policy_id}https://api.us2.ddog-gov.com/api/v2/on-call/escalation-policies/{policy_id}Overview
Update an On-Call escalation policy
Arguments
Path Parameters
policy_id [required]The ID of the escalation policy
Query Strings
includeComma-separated list of included relationships to be returned. Allowed values: teams, steps, steps.targets.
Request
Body Data (required)
data [required]Represents the data for updating an existing escalation policy, including its ID, attributes, relationships, and resource type.
attributes [required]Defines the attributes that can be updated for an escalation policy, such as description, name, resolution behavior, retries, and steps.
name [required]Specifies the name of the escalation policy.
resolve_page_on_policy_endIndicates whether the page is automatically resolved when the policy ends.
retriesSpecifies how many times the escalation sequence is retried if there is no response.
steps [required]A list of escalation steps, each defining assignment, escalation timeout, and targets.
assignmentSpecifies how this escalation step will assign targets (example default or round-robin).
default, round-robinescalate_after_secondsDefines how many seconds to wait before escalating to the next step.
idSpecifies the unique identifier of this step.
targets [required]Specifies the collection of escalation targets for this step.
configConfiguration for an escalation target, such as schedule position.
scheduleSchedule-specific configuration for an escalation target.
positionSpecifies the position of a schedule target (example previous, current, or next).
previous, current, nextidSpecifies the unique identifier for this target.
typeSpecifies the type of escalation target (example users, schedules, or teams).
users, schedules, teamsid [required]Specifies the unique identifier of the escalation policy being updated.
relationshipsRepresents relationships in an escalation policy update request, including references to teams.
teamsAssociates teams with this schedule in a data structure.
dataAn array of team references for this schedule.
id [required]The unique identifier of the team in this relationship.
type [required]Teams resource type.
teamsteamstype [required]Indicates that the resource is of type policies.
policiespolicies{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": false,
"retries": 2,
"steps": [
{
"assignment": "default",
"escalate_after_seconds": 3600,
"id": "00000000-aba1-0000-0000-000000000000",
"targets": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
]
}
]
},
"id": "a3000000-0000-0000-0000-000000000000",
"relationships": {
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
}
}Response
OK
Represents a complete escalation policy response, including policy data and optionally included related resources.
dataRepresents the data for a single escalation policy, including its attributes, ID, relationships, and resource type.
attributesDefines the main attributes of an escalation policy, such as its name and behavior on policy end.
name [required]Specifies the name of the escalation policy.
resolve_page_on_policy_endIndicates whether the page is automatically resolved when the policy ends.
retriesSpecifies how many times the escalation sequence is retried if there is no response.
tagsA list of tags attached to the escalation policy, in key:value format.
idSpecifies the unique identifier of the escalation policy.
relationshipsRepresents the relationships for an escalation policy, including references to steps and teams.
steps [required]Defines the relationship to a collection of steps within an escalation policy. Contains an array of step data references.
dataAn array of references to the steps defined in this escalation policy.
id [required]Specifies the unique identifier for the step resource.
type [required]Indicates that the resource is of type steps.
stepsstepsteamsAssociates teams with this schedule in a data structure.
dataAn array of team references for this schedule.
id [required]The unique identifier of the team in this relationship.
type [required]Teams resource type.
teamsteamstype [required]Indicates that the resource is of type policies.
policiespoliciesincludedProvides any included related resources, such as steps or targets, returned with the policy.
<type=steps>Represents a single step in an escalation policy, including its attributes, relationships, and resource type.
attributesDefines attributes for an escalation policy step, such as assignment strategy and escalation timeout.
assignmentSpecifies how this escalation step will assign targets (example default or round-robin).
default, round-robinescalate_after_secondsSpecifies how many seconds to wait before escalating to the next step.
idSpecifies the unique identifier of this escalation policy step.
relationshipsRepresents the relationship of an escalation policy step to its targets.
targetsA list of escalation targets for a step
dataThe EscalationTargets data.
<type=teams>Represents a team target for an escalation policy step, including the team's ID and resource type.
id [required]Specifies the unique identifier of the team resource.
type [required]Indicates that the resource is of type teams.
teamsteams<type=users>Represents a user target for an escalation policy step, including the user's ID and resource type.
id [required]Specifies the unique identifier of the user resource.
type [required]Indicates that the resource is of type users.
usersusers<type=schedules>Represents a schedule target for an escalation policy step, including its ID and resource type. This is a shortcut for a configured schedule target with position set to 'current'.
id [required]Specifies the unique identifier of the schedule resource.
type [required]Indicates that the resource is of type schedules.
schedulesschedules<type=schedule_target>Relationship reference to a configured schedule target.
id [required]Specifies the unique identifier of the configured schedule target.
type [required]Indicates that the resource is of type schedule_target.
schedule_targetschedule_targettype [required]Indicates that the resource is of type steps.
stepssteps<type=users>Represents a user object in the context of an escalation policy, including their id, type, and basic attributes.
attributesProvides basic user information for an escalation policy, including a name and email address.
colorThe user's on-call color, as a hex code (for example, #FF0000). Included only when user.color is requested in the include parameter.
emailThe user's email address.
nameThe user's name.
statusThe user's status.
active, deactivated, pendingidThe unique user identifier.
type [required]Users resource type.
usersusers<type=schedules>Represents the primary data object for a schedule, linking attributes and relationships.
attributesProvides core properties of a schedule object such as its name and time zone.
max_respondersMaximum number of users who can be on call at the same time. The value is between 1 and the number of layers, and no greater than 10.
nameA short name for the schedule.
tagsA list of tags associated with the schedule.
time_zoneThe time zone in which this schedule operates.
idThe schedule's unique identifier.
relationshipsGroups the relationships for a schedule object, referencing layers and teams.
layersAssociates layers with this schedule in a data structure.
dataAn array of layer references for this schedule.
id [required]The unique identifier of the layer in this relationship.
type [required]Layers resource type.
layerslayersteamsAssociates teams with this schedule in a data structure.
dataAn array of team references for this schedule.
id [required]The unique identifier of the team in this relationship.
type [required]Teams resource type.
teamsteamstype [required]Schedules resource type.
schedulesschedules<type=schedule_target>Full resource representation of a configured schedule target with position (previous, current, or next).
attributes [required]Attributes for a configured schedule target, including position.
position [required]Specifies the position of a schedule target (example previous, current, or next).
previous, current, nextid [required]Specifies the unique identifier of the configured schedule target.
relationships [required]Represents the relationships of a configured schedule target.
schedule [required]Holds the schedule reference for a configured schedule target.
data [required]Represents a schedule target for an escalation policy step, including its ID and resource type. This is a shortcut for a configured schedule target with position set to 'current'.
id [required]Specifies the unique identifier of the schedule resource.
type [required]Indicates that the resource is of type schedules.
schedulesschedulestype [required]Indicates that the resource is of type schedule_target.
schedule_targetschedule_target<type=teams>Provides a reference to a team, including ID, type, and basic attributes/relationships.
attributesEncapsulates the basic attributes of a Team reference, such as name, handle, and an optional avatar or description.
avatarURL or reference for the team's avatar (if available).
descriptionA short text describing the team.
handleA unique handle/slug for the team.
nameThe full, human-readable name of the team.
idThe team's unique identifier.
type [required]Teams resource type.
teamsteams{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": true,
"retries": 2
},
"id": "00000000-aba1-0000-0000-000000000000",
"relationships": {
"steps": {
"data": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "steps"
}
]
},
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
},
"included": [
{
"attributes": {
"avatar": "",
"description": "Team 1 description",
"handle": "team1",
"name": "Team 1"
},
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
},
{
"attributes": {
"assignment": "default",
"escalate_after_seconds": 3600
},
"id": "00000000-aba1-0000-0000-000000000000",
"relationships": {
"targets": {
"data": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
},
{
"id": "00000000-aba2-0000-0000-000000000000_previous",
"type": "schedule_target"
},
{
"id": "00000000-aba3-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "steps"
},
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
},
{
"attributes": {
"position": "previous"
},
"id": "00000000-aba2-0000-0000-000000000000_previous",
"relationships": {
"schedule": {
"data": {
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
}
},
"type": "schedule_target"
},
{
"id": "00000000-aba3-0000-0000-000000000000",
"type": "teams"
}
]
}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"
]
}Code Example
# Path parameters
export policy_id="a3000000-0000-0000-0000-000000000000"
# 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 PUT "https://api.${DD_SITE}/api/v2/on-call/escalation-policies/${policy_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": false,
"retries": 2,
"steps": [
{
"assignment": "default",
"escalate_after_seconds": 3600,
"id": "00000000-aba1-0000-0000-000000000000",
"targets": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
]
}
]
},
"id": "a3000000-0000-0000-0000-000000000000",
"relationships": {
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
}
}
EOF# Path parameters
export policy_id="a3000000-0000-0000-0000-000000000000"
# 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 PUT "https://api.${DD_SITE}/api/v2/on-call/escalation-policies/${policy_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": false,
"retries": 2,
"steps": [
{
"assignment": "default",
"escalate_after_seconds": 3600,
"id": "00000000-aba1-0000-0000-000000000000",
"targets": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
]
}
]
},
"id": "a3000000-0000-0000-0000-000000000000",
"relationships": {
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
}
}
EOF# Path parameters
export policy_id="a3000000-0000-0000-0000-000000000000"
# 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 PUT "https://api.${DD_SITE}/api/v2/on-call/escalation-policies/${policy_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": false,
"retries": 2,
"steps": [
{
"assignment": "default",
"escalate_after_seconds": 3600,
"id": "00000000-aba1-0000-0000-000000000000",
"targets": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
]
}
]
},
"id": "a3000000-0000-0000-0000-000000000000",
"relationships": {
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
}
}
EOF# Path parameters
export policy_id="a3000000-0000-0000-0000-000000000000"
# 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 PUT "https://api.${DD_SITE}/api/v2/on-call/escalation-policies/${policy_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": false,
"retries": 2,
"steps": [
{
"assignment": "default",
"escalate_after_seconds": 3600,
"id": "00000000-aba1-0000-0000-000000000000",
"targets": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
]
}
]
},
"id": "a3000000-0000-0000-0000-000000000000",
"relationships": {
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
}
}
EOF# Path parameters
export policy_id="a3000000-0000-0000-0000-000000000000"
# 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 PUT "https://api.${DD_SITE}/api/v2/on-call/escalation-policies/${policy_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": false,
"retries": 2,
"steps": [
{
"assignment": "default",
"escalate_after_seconds": 3600,
"id": "00000000-aba1-0000-0000-000000000000",
"targets": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
]
}
]
},
"id": "a3000000-0000-0000-0000-000000000000",
"relationships": {
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
}
}
EOF# Path parameters
export policy_id="a3000000-0000-0000-0000-000000000000"
# 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 PUT "https://api.${DD_SITE}/api/v2/on-call/escalation-policies/${policy_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": false,
"retries": 2,
"steps": [
{
"assignment": "default",
"escalate_after_seconds": 3600,
"id": "00000000-aba1-0000-0000-000000000000",
"targets": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
]
}
]
},
"id": "a3000000-0000-0000-0000-000000000000",
"relationships": {
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
}
}
EOF# Path parameters
export policy_id="a3000000-0000-0000-0000-000000000000"
# 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 PUT "https://api.${DD_SITE}/api/v2/on-call/escalation-policies/${policy_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": false,
"retries": 2,
"steps": [
{
"assignment": "default",
"escalate_after_seconds": 3600,
"id": "00000000-aba1-0000-0000-000000000000",
"targets": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
]
}
]
},
"id": "a3000000-0000-0000-0000-000000000000",
"relationships": {
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
}
}
EOF# Path parameters
export policy_id="a3000000-0000-0000-0000-000000000000"
# 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 PUT "https://api.${DD_SITE}/api/v2/on-call/escalation-policies/${policy_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": false,
"retries": 2,
"steps": [
{
"assignment": "default",
"escalate_after_seconds": 3600,
"id": "00000000-aba1-0000-0000-000000000000",
"targets": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
]
}
]
},
"id": "a3000000-0000-0000-0000-000000000000",
"relationships": {
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
}
}
EOF# Path parameters
export policy_id="a3000000-0000-0000-0000-000000000000"
# 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 PUT "https://api.${DD_SITE}/api/v2/on-call/escalation-policies/${policy_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"name": "Escalation Policy 1",
"resolve_page_on_policy_end": false,
"retries": 2,
"steps": [
{
"assignment": "default",
"escalate_after_seconds": 3600,
"id": "00000000-aba1-0000-0000-000000000000",
"targets": [
{
"id": "00000000-aba1-0000-0000-000000000000",
"type": "users"
},
{
"id": "00000000-aba2-0000-0000-000000000000",
"type": "schedules"
}
]
}
]
},
"id": "a3000000-0000-0000-0000-000000000000",
"relationships": {
"teams": {
"data": [
{
"id": "00000000-da3a-0000-0000-000000000000",
"type": "teams"
}
]
}
},
"type": "policies"
}
}
EOF// Update On-Call escalation policy returns "OK" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
// there is a valid "escalation_policy" in the system
EscalationPolicyDataID := os.Getenv("ESCALATION_POLICY_DATA_ID")
EscalationPolicyDataRelationshipsStepsData0ID := os.Getenv("ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID")
// there is a valid "user" in the system
UserDataID := os.Getenv("USER_DATA_ID")
// there is a valid "dd_team" in the system
DdTeamDataID := os.Getenv("DD_TEAM_DATA_ID")
body := datadogV2.EscalationPolicyUpdateRequest{
Data: datadogV2.EscalationPolicyUpdateRequestData{
Attributes: datadogV2.EscalationPolicyUpdateRequestDataAttributes{
Name: "Example-On-Call-updated",
ResolvePageOnPolicyEnd: datadog.PtrBool(false),
Retries: datadog.PtrInt64(0),
Steps: []datadogV2.EscalationPolicyUpdateRequestDataAttributesStepsItems{
{
Assignment: datadogV2.ESCALATIONPOLICYSTEPATTRIBUTESASSIGNMENT_DEFAULT.Ptr(),
EscalateAfterSeconds: datadog.PtrInt64(3600),
Id: datadog.PtrString(EscalationPolicyDataRelationshipsStepsData0ID),
Targets: []datadogV2.EscalationPolicyStepTarget{
{
Id: datadog.PtrString(UserDataID),
Type: datadogV2.ESCALATIONPOLICYSTEPTARGETTYPE_USERS.Ptr(),
},
},
},
},
},
Id: EscalationPolicyDataID,
Relationships: &datadogV2.EscalationPolicyUpdateRequestDataRelationships{
Teams: &datadogV2.DataRelationshipsTeams{
Data: []datadogV2.DataRelationshipsTeamsDataItems{
{
Id: DdTeamDataID,
Type: datadogV2.DATARELATIONSHIPSTEAMSDATAITEMSTYPE_TEAMS,
},
},
},
},
Type: datadogV2.ESCALATIONPOLICYUPDATEREQUESTDATATYPE_POLICIES,
},
}
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.NewOnCallApi(apiClient)
resp, r, err := api.UpdateOnCallEscalationPolicy(ctx, EscalationPolicyDataID, body, *datadogV2.NewUpdateOnCallEscalationPolicyOptionalParameters())
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `OnCallApi.UpdateOnCallEscalationPolicy`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `OnCallApi.UpdateOnCallEscalationPolicy`:\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 On-Call escalation policy returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.OnCallApi;
import com.datadog.api.client.v2.model.DataRelationshipsTeams;
import com.datadog.api.client.v2.model.DataRelationshipsTeamsDataItems;
import com.datadog.api.client.v2.model.DataRelationshipsTeamsDataItemsType;
import com.datadog.api.client.v2.model.EscalationPolicy;
import com.datadog.api.client.v2.model.EscalationPolicyStepAttributesAssignment;
import com.datadog.api.client.v2.model.EscalationPolicyStepTarget;
import com.datadog.api.client.v2.model.EscalationPolicyStepTargetType;
import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequest;
import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestData;
import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataAttributes;
import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataAttributesStepsItems;
import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataRelationships;
import com.datadog.api.client.v2.model.EscalationPolicyUpdateRequestDataType;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
OnCallApi apiInstance = new OnCallApi(defaultClient);
// there is a valid "escalation_policy" in the system
String ESCALATION_POLICY_DATA_ID = System.getenv("ESCALATION_POLICY_DATA_ID");
String ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID =
System.getenv("ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID");
// there is a valid "user" in the system
String USER_DATA_ID = System.getenv("USER_DATA_ID");
// there is a valid "dd_team" in the system
String DD_TEAM_DATA_ID = System.getenv("DD_TEAM_DATA_ID");
EscalationPolicyUpdateRequest body =
new EscalationPolicyUpdateRequest()
.data(
new EscalationPolicyUpdateRequestData()
.attributes(
new EscalationPolicyUpdateRequestDataAttributes()
.name("Example-On-Call-updated")
.resolvePageOnPolicyEnd(false)
.retries(0L)
.steps(
Collections.singletonList(
new EscalationPolicyUpdateRequestDataAttributesStepsItems()
.assignment(
EscalationPolicyStepAttributesAssignment.DEFAULT)
.escalateAfterSeconds(3600L)
.id(ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID)
.targets(
Collections.singletonList(
new EscalationPolicyStepTarget()
.id(USER_DATA_ID)
.type(EscalationPolicyStepTargetType.USERS))))))
.id(ESCALATION_POLICY_DATA_ID)
.relationships(
new EscalationPolicyUpdateRequestDataRelationships()
.teams(
new DataRelationshipsTeams()
.data(
Collections.singletonList(
new DataRelationshipsTeamsDataItems()
.id(DD_TEAM_DATA_ID)
.type(DataRelationshipsTeamsDataItemsType.TEAMS)))))
.type(EscalationPolicyUpdateRequestDataType.POLICIES));
try {
EscalationPolicy result =
apiInstance.updateOnCallEscalationPolicy(ESCALATION_POLICY_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling OnCallApi#updateOnCallEscalationPolicy");
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 On-Call escalation policy returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.on_call_api import OnCallApi
from datadog_api_client.v2.model.data_relationships_teams import DataRelationshipsTeams
from datadog_api_client.v2.model.data_relationships_teams_data_items import DataRelationshipsTeamsDataItems
from datadog_api_client.v2.model.data_relationships_teams_data_items_type import DataRelationshipsTeamsDataItemsType
from datadog_api_client.v2.model.escalation_policy_step_attributes_assignment import (
EscalationPolicyStepAttributesAssignment,
)
from datadog_api_client.v2.model.escalation_policy_step_target import EscalationPolicyStepTarget
from datadog_api_client.v2.model.escalation_policy_step_target_type import EscalationPolicyStepTargetType
from datadog_api_client.v2.model.escalation_policy_update_request import EscalationPolicyUpdateRequest
from datadog_api_client.v2.model.escalation_policy_update_request_data import EscalationPolicyUpdateRequestData
from datadog_api_client.v2.model.escalation_policy_update_request_data_attributes import (
EscalationPolicyUpdateRequestDataAttributes,
)
from datadog_api_client.v2.model.escalation_policy_update_request_data_attributes_steps_items import (
EscalationPolicyUpdateRequestDataAttributesStepsItems,
)
from datadog_api_client.v2.model.escalation_policy_update_request_data_relationships import (
EscalationPolicyUpdateRequestDataRelationships,
)
from datadog_api_client.v2.model.escalation_policy_update_request_data_type import EscalationPolicyUpdateRequestDataType
# there is a valid "escalation_policy" in the system
ESCALATION_POLICY_DATA_ID = environ["ESCALATION_POLICY_DATA_ID"]
ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID = environ["ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID"]
# there is a valid "user" in the system
USER_DATA_ID = environ["USER_DATA_ID"]
# there is a valid "dd_team" in the system
DD_TEAM_DATA_ID = environ["DD_TEAM_DATA_ID"]
body = EscalationPolicyUpdateRequest(
data=EscalationPolicyUpdateRequestData(
attributes=EscalationPolicyUpdateRequestDataAttributes(
name="Example-On-Call-updated",
resolve_page_on_policy_end=False,
retries=0,
steps=[
EscalationPolicyUpdateRequestDataAttributesStepsItems(
assignment=EscalationPolicyStepAttributesAssignment.DEFAULT,
escalate_after_seconds=3600,
id=ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID,
targets=[
EscalationPolicyStepTarget(
id=USER_DATA_ID,
type=EscalationPolicyStepTargetType.USERS,
),
],
),
],
),
id=ESCALATION_POLICY_DATA_ID,
relationships=EscalationPolicyUpdateRequestDataRelationships(
teams=DataRelationshipsTeams(
data=[
DataRelationshipsTeamsDataItems(
id=DD_TEAM_DATA_ID,
type=DataRelationshipsTeamsDataItemsType.TEAMS,
),
],
),
),
type=EscalationPolicyUpdateRequestDataType.POLICIES,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = OnCallApi(api_client)
response = api_instance.update_on_call_escalation_policy(policy_id=ESCALATION_POLICY_DATA_ID, body=body)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.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 On-Call escalation policy returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::OnCallAPI.new
# there is a valid "escalation_policy" in the system
ESCALATION_POLICY_DATA_ID = ENV["ESCALATION_POLICY_DATA_ID"]
ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID = ENV["ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID"]
# there is a valid "user" in the system
USER_DATA_ID = ENV["USER_DATA_ID"]
# there is a valid "dd_team" in the system
DD_TEAM_DATA_ID = ENV["DD_TEAM_DATA_ID"]
body = DatadogAPIClient::V2::EscalationPolicyUpdateRequest.new({
data: DatadogAPIClient::V2::EscalationPolicyUpdateRequestData.new({
attributes: DatadogAPIClient::V2::EscalationPolicyUpdateRequestDataAttributes.new({
name: "Example-On-Call-updated",
resolve_page_on_policy_end: false,
retries: 0,
steps: [
DatadogAPIClient::V2::EscalationPolicyUpdateRequestDataAttributesStepsItems.new({
assignment: DatadogAPIClient::V2::EscalationPolicyStepAttributesAssignment::DEFAULT,
escalate_after_seconds: 3600,
id: ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID,
targets: [
DatadogAPIClient::V2::EscalationPolicyStepTarget.new({
id: USER_DATA_ID,
type: DatadogAPIClient::V2::EscalationPolicyStepTargetType::USERS,
}),
],
}),
],
}),
id: ESCALATION_POLICY_DATA_ID,
relationships: DatadogAPIClient::V2::EscalationPolicyUpdateRequestDataRelationships.new({
teams: DatadogAPIClient::V2::DataRelationshipsTeams.new({
data: [
DatadogAPIClient::V2::DataRelationshipsTeamsDataItems.new({
id: DD_TEAM_DATA_ID,
type: DatadogAPIClient::V2::DataRelationshipsTeamsDataItemsType::TEAMS,
}),
],
}),
}),
type: DatadogAPIClient::V2::EscalationPolicyUpdateRequestDataType::POLICIES,
}),
})
p api_instance.update_on_call_escalation_policy(ESCALATION_POLICY_DATA_ID, body)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.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 On-Call escalation policy returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_on_call::OnCallAPI;
use datadog_api_client::datadogV2::api_on_call::UpdateOnCallEscalationPolicyOptionalParams;
use datadog_api_client::datadogV2::model::DataRelationshipsTeams;
use datadog_api_client::datadogV2::model::DataRelationshipsTeamsDataItems;
use datadog_api_client::datadogV2::model::DataRelationshipsTeamsDataItemsType;
use datadog_api_client::datadogV2::model::EscalationPolicyStepAttributesAssignment;
use datadog_api_client::datadogV2::model::EscalationPolicyStepTarget;
use datadog_api_client::datadogV2::model::EscalationPolicyStepTargetType;
use datadog_api_client::datadogV2::model::EscalationPolicyUpdateRequest;
use datadog_api_client::datadogV2::model::EscalationPolicyUpdateRequestData;
use datadog_api_client::datadogV2::model::EscalationPolicyUpdateRequestDataAttributes;
use datadog_api_client::datadogV2::model::EscalationPolicyUpdateRequestDataAttributesStepsItems;
use datadog_api_client::datadogV2::model::EscalationPolicyUpdateRequestDataRelationships;
use datadog_api_client::datadogV2::model::EscalationPolicyUpdateRequestDataType;
#[tokio::main]
async fn main() {
// there is a valid "escalation_policy" in the system
let escalation_policy_data_id = std::env::var("ESCALATION_POLICY_DATA_ID").unwrap();
let escalation_policy_data_relationships_steps_data_0_id =
std::env::var("ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID").unwrap();
// there is a valid "user" in the system
let user_data_id = std::env::var("USER_DATA_ID").unwrap();
// there is a valid "dd_team" in the system
let dd_team_data_id = std::env::var("DD_TEAM_DATA_ID").unwrap();
let body = EscalationPolicyUpdateRequest::new(
EscalationPolicyUpdateRequestData::new(
EscalationPolicyUpdateRequestDataAttributes::new(
"Example-On-Call-updated".to_string(),
vec![
EscalationPolicyUpdateRequestDataAttributesStepsItems::new(vec![
EscalationPolicyStepTarget::new()
.id(user_data_id.clone())
.type_(EscalationPolicyStepTargetType::USERS),
])
.assignment(EscalationPolicyStepAttributesAssignment::DEFAULT)
.escalate_after_seconds(3600)
.id(escalation_policy_data_relationships_steps_data_0_id.clone()),
],
)
.resolve_page_on_policy_end(false)
.retries(0),
escalation_policy_data_id.clone(),
EscalationPolicyUpdateRequestDataType::POLICIES,
)
.relationships(EscalationPolicyUpdateRequestDataRelationships::new().teams(
DataRelationshipsTeams::new().data(vec![DataRelationshipsTeamsDataItems::new(
dd_team_data_id.clone(),
DataRelationshipsTeamsDataItemsType::TEAMS,
)]),
)),
);
let configuration = datadog::Configuration::new();
let api = OnCallAPI::with_config(configuration);
let resp = api
.update_on_call_escalation_policy(
escalation_policy_data_id.clone(),
body,
UpdateOnCallEscalationPolicyOptionalParams::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/**
* Update On-Call escalation policy 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.OnCallApi(configuration);
// there is a valid "escalation_policy" in the system
const ESCALATION_POLICY_DATA_ID = process.env
.ESCALATION_POLICY_DATA_ID as string;
const ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID = process.env
.ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID as string;
// there is a valid "user" in the system
const USER_DATA_ID = process.env.USER_DATA_ID as string;
// there is a valid "dd_team" in the system
const DD_TEAM_DATA_ID = process.env.DD_TEAM_DATA_ID as string;
const params: v2.OnCallApiUpdateOnCallEscalationPolicyRequest = {
body: {
data: {
attributes: {
name: "Example-On-Call-updated",
resolvePageOnPolicyEnd: false,
retries: 0,
steps: [
{
assignment: "default",
escalateAfterSeconds: 3600,
id: ESCALATION_POLICY_DATA_RELATIONSHIPS_STEPS_DATA_0_ID,
targets: [
{
id: USER_DATA_ID,
type: "users",
},
],
},
],
},
id: ESCALATION_POLICY_DATA_ID,
relationships: {
teams: {
data: [
{
id: DD_TEAM_DATA_ID,
type: "teams",
},
],
},
},
type: "policies",
},
},
policyId: ESCALATION_POLICY_DATA_ID,
};
apiInstance
.updateOnCallEscalationPolicy(params)
.then((data: v2.EscalationPolicy) => {
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"