Update an existing Workflow
https://api.datadoghq.com/api/v2/workflows/{workflow_id}https://api.us3.datadoghq.com/api/v2/workflows/{workflow_id}https://api.us5.datadoghq.com/api/v2/workflows/{workflow_id}https://api.datadoghq.eu/api/v2/workflows/{workflow_id}https://api.ap1.datadoghq.com/api/v2/workflows/{workflow_id}https://api.ap2.datadoghq.com/api/v2/workflows/{workflow_id}https://api.uk1.datadoghq.com/api/v2/workflows/{workflow_id}https://api.ddog-gov.com/api/v2/workflows/{workflow_id}https://api.us2.ddog-gov.com/api/v2/workflows/{workflow_id}概要
Update a workflow by ID. This API requires a registered application key. Alternatively, you can configure these permissions in the UI.
引数
パスパラメーター
workflow_id [required]The ID of the workflow.
リクエスト
Body Data (required)
data [required]Data related to the workflow being updated.
attributes [required]The definition of WorkflowDataUpdateAttributes object.
descriptionDescription of the workflow.
nameName of the workflow.
publishedSet the workflow to published or unpublished. Workflows in an unpublished state will only be executable via manual runs. Automatic triggers such as Schedule will not execute the workflow until it is published.
runAsIdentity used to run the workflow.
<type=owner>Run the workflow as its owner.
type [required]The owner run-as type.
owner<type=service_account>Run the workflow as a service account.
id [required]The service account identifier.
type [required]The service account run-as type.
service_account<type=initiator>Run the workflow as the user who initiates the execution.
type [required]The initiator run-as type.
initiatorrunAsUserModeThe effective type of identity used to run the workflow.
owner, service_account, initiatorsensitivePrivilegesWhether the workflow requires sensitive privileges to run. Only the workflow owner can update this field. This allows it to run actions that use Execution Policies.
specA complete Workflow Automation definition, including its triggers, steps, and connections.
annotationsUp to 100 text annotations displayed on the workflow canvas.
display [required]The annotation's position and size on the workflow canvas.
boundsCanvas coordinates and dimensions for an annotation on the workflow canvas.
heightThe annotation's height on the canvas.
widthThe annotation's width on the canvas.
xThe annotation's horizontal canvas coordinate.
yThe annotation's vertical canvas coordinate.
id [required]The unique identifier of this annotation within the workflow.
markdownTextAnnotation [required]Markdown content displayed in an annotation.
textThe annotation's Markdown content.
connectionEnvsA list of connections or connection groups used in the workflow.
connectionGroupsThe ConnectionEnv connectionGroups.
connectionGroupId [required]The ConnectionGroup connectionGroupId.
label [required]The ConnectionGroup label.
tags [required]The ConnectionGroup tags.
connectionsThe ConnectionEnv connections.
connectionId [required]The Connection connectionId.
label [required]The Connection label.
env [required]The definition of ConnectionEnvEnv object.
defaulthandleUnique identifier used to trigger workflows automatically in Datadog.
inputSchemaA list of input parameters for the workflow. Input parameters are available under the Trigger object and can be referenced in workflow steps using {{ Trigger.<parameter_name> }}.
parametersThe InputSchema parameters.
allowExtraValuesThe InputSchemaParameters allowExtraValues.
allowedValuesThe InputSchemaParameters allowedValues.
defaultValueThe InputSchemaParameters defaultValue.
descriptionThe InputSchemaParameters description.
labelThe InputSchemaParameters label.
name [required]The InputSchemaParameters name.
type [required]The definition of InputSchemaParametersType object.
STRING, NUMBER, BOOLEAN, OBJECT, ARRAY_STRING, ARRAY_NUMBER, ARRAY_BOOLEAN, ARRAY_OBJECToutputSchemaA list of output parameters for the workflow.
parametersThe OutputSchema parameters.
defaultValueThe OutputSchemaParameters defaultValue.
descriptionThe OutputSchemaParameters description.
labelThe OutputSchemaParameters label.
name [required]The OutputSchemaParameters name.
type [required]The definition of OutputSchemaParametersType object.
STRING, NUMBER, BOOLEAN, OBJECT, ARRAY_STRING, ARRAY_NUMBER, ARRAY_BOOLEAN, ARRAY_OBJECTvalueThe OutputSchemaParameters value.
stepsA Step is a sub-component of a workflow. Each Step performs an action.
actionId [required]The unique identifier of an action.
completionGateUsed to create conditions before running subsequent actions.
completionCondition [required]The definition of CompletionCondition object.
operand1 [required]The CompletionCondition operand1.
operand2The CompletionCondition operand2.
operator [required]The definition of CompletionConditionOperator object.
OPERATOR_EQUAL, OPERATOR_NOT_EQUAL, OPERATOR_GREATER_THAN, OPERATOR_LESS_THAN, OPERATOR_GREATER_THAN_OR_EQUAL_TO, OPERATOR_LESS_THAN_OR_EQUAL_TO, OPERATOR_CONTAINS, OPERATOR_DOES_NOT_CONTAIN, OPERATOR_IS_NULL, OPERATOR_IS_NOT_NULLShow 2 more
OPERATOR_IS_EMPTY, OPERATOR_IS_NOT_EMPTYretryStrategy [required]The definition of RetryStrategy object.
kind [required]The definition of RetryStrategyKind object.
RETRY_STRATEGY_LINEARlinear [required]The definition of RetryStrategyLinear object.
interval [required]The RetryStrategyLinear interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
maxRetries [required]The RetryStrategyLinear maxRetries.
connectionLabelThe unique identifier of a connection defined in the spec.
displayThe position of a step on the workflow canvas. Omit display from every step to use
automatic layout, or provide it for every step to preserve a manual layout.
boundsThe definition of StepDisplayBounds object.
xThe bounds x.
yThe bounds y.
errorHandlersThe Step errorHandlers.
fallbackStepName [required]The ErrorHandler fallbackStepName.
retryStrategy [required]The definition of RetryStrategy object.
kind [required]The definition of RetryStrategyKind object.
RETRY_STRATEGY_LINEARlinear [required]The definition of RetryStrategyLinear object.
interval [required]The RetryStrategyLinear interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
maxRetries [required]The RetryStrategyLinear maxRetries.
name [required]Name of the step.
outboundEdgesA list of subsequent actions to run. This list is empty for a terminal step.
branchName [required]The OutboundEdge branchName.
nextStepName [required]The OutboundEdge nextStepName.
parametersA list of inputs for an action.
name [required]The Parameter name.
value [required]The Parameter value.
readinessGateUsed to merge multiple branches into a single branch.
thresholdType [required]The definition of ReadinessGateThresholdType object.
ANY, ALLtriggersThe list of triggers that activate this workflow. At least one trigger is required, and each trigger type may appear at most once.
Object 1Schema for an agent-based trigger.
agentTrigger [required]Trigger a workflow from an agent via the MCP execute tool. Workflow can be executed from Bits Chat, Bits Agent Builder, Claude Code, Codex, Cursor, and any other coding agent using the Datadog MCP.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 2Schema for an API-based trigger.
apiTrigger [required]Trigger a workflow from an API request. The workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 3Schema for an App-based trigger.
appTrigger [required]Trigger a workflow from an App.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 4Schema for a Case-based trigger.
caseTrigger [required]Trigger a workflow from a Case. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 5Schema for a Change Event-based trigger.
changeEventTrigger [required]Trigger a workflow from a Change Event.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 6Schema for a Database Monitoring-based trigger.
databaseMonitoringTrigger [required]Trigger a workflow from Database Monitoring.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 7Schema for a Datastore-based trigger.
datastoreTrigger [required]Trigger a workflow from a Datastore. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 8Schema for a Dashboard-based trigger.
dashboardTrigger [required]Trigger a workflow from a Dashboard.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 9Schema for a Form-based trigger.
formTrigger [required]Trigger a workflow from a Form.
formIdThe form UUID.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 10Schema for a GitHub webhook-based trigger.
githubWebhookTrigger [required]Trigger a workflow from a GitHub webhook. To trigger a workflow from GitHub, you must set a webhookSecret. In your GitHub Webhook Settings, set the Payload URL to "base_url"/api/v2/workflows/"workflow_id"/webhook?orgId="org_id", select application/json for the content type, and be highly recommend enabling SSL verification for security. The workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 11Schema for an incident declared trigger.
incidentCreatedTrigger [required]Trigger a workflow when an incident is declared.
incidentTypeThe type of incident that triggers the workflow.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 12Schema for an incident impact created trigger.
incidentImpactCreatedTrigger [required]Trigger a workflow when an impact is created for an incident.
executionLimitThe maximum number of times to execute a workflow for an incident.
count [required]The maximum number of workflow executions.
incidentTypeThe type of incident that triggers the workflow.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 13Schema for an incident impact updated trigger.
incidentImpactUpdatedTrigger [required]Trigger a workflow when an impact is updated for an incident.
executionLimitThe maximum number of times to execute a workflow for an incident.
count [required]The maximum number of workflow executions.
incidentTypeThe type of incident that triggers the workflow.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 14Schema for an incident postmortem updated trigger.
incidentPostmortemUpdatedTrigger [required]Trigger a workflow when a postmortem is updated for an incident.
executionLimitThe maximum number of times to execute a workflow for an incident.
count [required]The maximum number of workflow executions.
incidentTypeThe type of incident that triggers the workflow.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 15Schema for an incident responder created trigger.
incidentResponderCreatedTrigger [required]Trigger a workflow when a responder is created for an incident.
executionLimitThe maximum number of times to execute a workflow for an incident.
count [required]The maximum number of workflow executions.
incidentTypeThe type of incident that triggers the workflow.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 16Schema for an incident declared or updated trigger.
incidentSavedTrigger [required]Trigger a workflow when an incident is declared or updated.
executionLimitThe maximum number of times to execute a workflow for an incident.
count [required]The maximum number of workflow executions.
incidentTypeThe type of incident that triggers the workflow.
serialExecutionWhether to execute the workflow serially for an incident.
enabled [required]Whether serial execution is enabled.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 17Schema for an incident schedule trigger.
incidentScheduleTrigger [required]Trigger a workflow on a schedule for an incident.
incidentTypeThe type of incident that triggers the workflow.
rrule [required]The recurrence rule for the schedule, expressed as an iCalendar RRULE string.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 18Schema for an incident-based trigger.
incidentTrigger [required]Trigger a workflow from an incident. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
versionVersion of the incident manual trigger.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 19Schema for a Monitor-based trigger.
monitorTrigger [required]Trigger a workflow from a Monitor. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 20Schema for a Notebook-based trigger.
notebookTrigger [required]Trigger a workflow from a Notebook.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 21Schema for an On-Call shift change trigger.
onCallShiftChangeTrigger [required]Trigger a workflow when an On-Call shift changes. The workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 22Schema for an On-Call-based trigger.
onCallTrigger [required]Trigger a workflow from an On-Call Page or On-Call Handover. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 23Schema for a Schedule-based trigger.
scheduleTrigger [required]Trigger a workflow from a Schedule. The workflow must be published.
overlapBehaviorControls whether a scheduled workflow run may start while another instance is still running.
EXCLUSIVE_RUNEXCLUSIVE_RUN, OVERLAP_ALLOWEDrruleExpression [required]Recurrence rule expression for scheduling.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 24Schema for a Security-based trigger.
securityTrigger [required]Trigger a workflow from a Security Signal or Finding. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 25Schema for a Self Service-based trigger.
selfServiceTrigger [required]Trigger a workflow from Self Service.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 26Schema for a Slack-based trigger.
slackTrigger [required]Trigger a workflow from Slack. The workflow must be published.
reactionTriggersSlack emoji reactions that trigger the workflow.
reactionEmoji [required]The Slack emoji reaction name.
teamId [required]The Slack workspace ID.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 27Schema for a Software Catalog-based trigger.
softwareCatalogTrigger [required]Trigger a workflow from Software Catalog.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 28Schema for a Workflow-based trigger.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
workflowTrigger [required]Trigger a workflow from the Datadog UI. When present, this must be the workflow's only trigger.
tagsTags of the workflow.
webhookSecretIf a Webhook trigger is defined on this workflow, a webhookSecret is required and should be provided here.
idThe workflow identifier
type [required]The definition of WorkflowDataType object.
workflows{
"data": {
"attributes": {
"description": "A sample workflow.",
"name": "Example Workflow",
"published": true,
"runAs": {
"type": "owner"
},
"sensitivePrivileges": false,
"spec": {
"connectionEnvs": [
{
"connections": [
{
"connectionId": "e1e64943-c7c5-4487-aece-25aaec7d3aad",
"label": "INTEGRATION_DATADOG"
}
],
"env": "default"
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "default",
"name": "input",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "outputValue"
}
]
},
"steps": [
{
"actionId": "com.datadoghq.dd.monitor.listMonitors",
"connectionLabel": "INTEGRATION_DATADOG",
"name": "Step1",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "tags",
"value": "service:monitoring"
}
]
},
{
"actionId": "com.datadoghq.core.noop",
"name": "Step2"
}
],
"triggers": [
{
"monitorTrigger": {
"rateLimit": {
"count": 1,
"interval": "3600s"
}
},
"startStepNames": [
"Step1"
]
},
{
"startStepNames": [
"Step1"
],
"githubWebhookTrigger": {}
}
]
},
"tags": [
"team:infra",
"service:monitoring",
"foo:bar"
]
},
"id": "22222222-2222-2222-2222-222222222222",
"type": "workflows"
}
}応答
Successfully updated a workflow.
The response object after updating a workflow.
dataData related to the workflow being updated.
attributes [required]The definition of WorkflowDataUpdateAttributes object.
createdAtWhen the workflow was created.
descriptionDescription of the workflow.
nameName of the workflow.
publishedSet the workflow to published or unpublished. Workflows in an unpublished state will only be executable via manual runs. Automatic triggers such as Schedule will not execute the workflow until it is published.
runAsIdentity used to run the workflow.
<type=owner>Run the workflow as its owner.
type [required]The owner run-as type.
owner<type=service_account>Run the workflow as a service account.
id [required]The service account identifier.
type [required]The service account run-as type.
service_account<type=initiator>Run the workflow as the user who initiates the execution.
type [required]The initiator run-as type.
initiatorrunAsUserModeThe effective type of identity used to run the workflow.
owner, service_account, initiatorsensitivePrivilegesWhether the workflow requires sensitive privileges to run. Only the workflow owner can update this field. This allows it to run actions that use Execution Policies.
specA complete Workflow Automation definition, including its triggers, steps, and connections.
annotationsUp to 100 text annotations displayed on the workflow canvas.
display [required]The annotation's position and size on the workflow canvas.
boundsCanvas coordinates and dimensions for an annotation on the workflow canvas.
heightThe annotation's height on the canvas.
widthThe annotation's width on the canvas.
xThe annotation's horizontal canvas coordinate.
yThe annotation's vertical canvas coordinate.
id [required]The unique identifier of this annotation within the workflow.
markdownTextAnnotation [required]Markdown content displayed in an annotation.
textThe annotation's Markdown content.
connectionEnvsA list of connections or connection groups used in the workflow.
connectionGroupsThe ConnectionEnv connectionGroups.
connectionGroupId [required]The ConnectionGroup connectionGroupId.
label [required]The ConnectionGroup label.
tags [required]The ConnectionGroup tags.
connectionsThe ConnectionEnv connections.
connectionId [required]The Connection connectionId.
label [required]The Connection label.
env [required]The definition of ConnectionEnvEnv object.
defaulthandleUnique identifier used to trigger workflows automatically in Datadog.
inputSchemaA list of input parameters for the workflow. Input parameters are available under the Trigger object and can be referenced in workflow steps using {{ Trigger.<parameter_name> }}.
parametersThe InputSchema parameters.
allowExtraValuesThe InputSchemaParameters allowExtraValues.
allowedValuesThe InputSchemaParameters allowedValues.
defaultValueThe InputSchemaParameters defaultValue.
descriptionThe InputSchemaParameters description.
labelThe InputSchemaParameters label.
name [required]The InputSchemaParameters name.
type [required]The definition of InputSchemaParametersType object.
STRING, NUMBER, BOOLEAN, OBJECT, ARRAY_STRING, ARRAY_NUMBER, ARRAY_BOOLEAN, ARRAY_OBJECToutputSchemaA list of output parameters for the workflow.
parametersThe OutputSchema parameters.
defaultValueThe OutputSchemaParameters defaultValue.
descriptionThe OutputSchemaParameters description.
labelThe OutputSchemaParameters label.
name [required]The OutputSchemaParameters name.
type [required]The definition of OutputSchemaParametersType object.
STRING, NUMBER, BOOLEAN, OBJECT, ARRAY_STRING, ARRAY_NUMBER, ARRAY_BOOLEAN, ARRAY_OBJECTvalueThe OutputSchemaParameters value.
stepsA Step is a sub-component of a workflow. Each Step performs an action.
actionId [required]The unique identifier of an action.
completionGateUsed to create conditions before running subsequent actions.
completionCondition [required]The definition of CompletionCondition object.
operand1 [required]The CompletionCondition operand1.
operand2The CompletionCondition operand2.
operator [required]The definition of CompletionConditionOperator object.
OPERATOR_EQUAL, OPERATOR_NOT_EQUAL, OPERATOR_GREATER_THAN, OPERATOR_LESS_THAN, OPERATOR_GREATER_THAN_OR_EQUAL_TO, OPERATOR_LESS_THAN_OR_EQUAL_TO, OPERATOR_CONTAINS, OPERATOR_DOES_NOT_CONTAIN, OPERATOR_IS_NULL, OPERATOR_IS_NOT_NULLShow 2 more
OPERATOR_IS_EMPTY, OPERATOR_IS_NOT_EMPTYretryStrategy [required]The definition of RetryStrategy object.
kind [required]The definition of RetryStrategyKind object.
RETRY_STRATEGY_LINEARlinear [required]The definition of RetryStrategyLinear object.
interval [required]The RetryStrategyLinear interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
maxRetries [required]The RetryStrategyLinear maxRetries.
connectionLabelThe unique identifier of a connection defined in the spec.
displayThe position of a step on the workflow canvas. Omit display from every step to use
automatic layout, or provide it for every step to preserve a manual layout.
boundsThe definition of StepDisplayBounds object.
xThe bounds x.
yThe bounds y.
errorHandlersThe Step errorHandlers.
fallbackStepName [required]The ErrorHandler fallbackStepName.
retryStrategy [required]The definition of RetryStrategy object.
kind [required]The definition of RetryStrategyKind object.
RETRY_STRATEGY_LINEARlinear [required]The definition of RetryStrategyLinear object.
interval [required]The RetryStrategyLinear interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
maxRetries [required]The RetryStrategyLinear maxRetries.
name [required]Name of the step.
outboundEdgesA list of subsequent actions to run. This list is empty for a terminal step.
branchName [required]The OutboundEdge branchName.
nextStepName [required]The OutboundEdge nextStepName.
parametersA list of inputs for an action.
name [required]The Parameter name.
value [required]The Parameter value.
readinessGateUsed to merge multiple branches into a single branch.
thresholdType [required]The definition of ReadinessGateThresholdType object.
ANY, ALLtriggersThe list of triggers that activate this workflow. At least one trigger is required, and each trigger type may appear at most once.
Object 1Schema for an agent-based trigger.
agentTrigger [required]Trigger a workflow from an agent via the MCP execute tool. Workflow can be executed from Bits Chat, Bits Agent Builder, Claude Code, Codex, Cursor, and any other coding agent using the Datadog MCP.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 2Schema for an API-based trigger.
apiTrigger [required]Trigger a workflow from an API request. The workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 3Schema for an App-based trigger.
appTrigger [required]Trigger a workflow from an App.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 4Schema for a Case-based trigger.
caseTrigger [required]Trigger a workflow from a Case. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 5Schema for a Change Event-based trigger.
changeEventTrigger [required]Trigger a workflow from a Change Event.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 6Schema for a Database Monitoring-based trigger.
databaseMonitoringTrigger [required]Trigger a workflow from Database Monitoring.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 7Schema for a Datastore-based trigger.
datastoreTrigger [required]Trigger a workflow from a Datastore. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 8Schema for a Dashboard-based trigger.
dashboardTrigger [required]Trigger a workflow from a Dashboard.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 9Schema for a Form-based trigger.
formTrigger [required]Trigger a workflow from a Form.
formIdThe form UUID.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 10Schema for a GitHub webhook-based trigger.
githubWebhookTrigger [required]Trigger a workflow from a GitHub webhook. To trigger a workflow from GitHub, you must set a webhookSecret. In your GitHub Webhook Settings, set the Payload URL to "base_url"/api/v2/workflows/"workflow_id"/webhook?orgId="org_id", select application/json for the content type, and be highly recommend enabling SSL verification for security. The workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 11Schema for an incident declared trigger.
incidentCreatedTrigger [required]Trigger a workflow when an incident is declared.
incidentTypeThe type of incident that triggers the workflow.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 12Schema for an incident impact created trigger.
incidentImpactCreatedTrigger [required]Trigger a workflow when an impact is created for an incident.
executionLimitThe maximum number of times to execute a workflow for an incident.
count [required]The maximum number of workflow executions.
incidentTypeThe type of incident that triggers the workflow.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 13Schema for an incident impact updated trigger.
incidentImpactUpdatedTrigger [required]Trigger a workflow when an impact is updated for an incident.
executionLimitThe maximum number of times to execute a workflow for an incident.
count [required]The maximum number of workflow executions.
incidentTypeThe type of incident that triggers the workflow.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 14Schema for an incident postmortem updated trigger.
incidentPostmortemUpdatedTrigger [required]Trigger a workflow when a postmortem is updated for an incident.
executionLimitThe maximum number of times to execute a workflow for an incident.
count [required]The maximum number of workflow executions.
incidentTypeThe type of incident that triggers the workflow.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 15Schema for an incident responder created trigger.
incidentResponderCreatedTrigger [required]Trigger a workflow when a responder is created for an incident.
executionLimitThe maximum number of times to execute a workflow for an incident.
count [required]The maximum number of workflow executions.
incidentTypeThe type of incident that triggers the workflow.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 16Schema for an incident declared or updated trigger.
incidentSavedTrigger [required]Trigger a workflow when an incident is declared or updated.
executionLimitThe maximum number of times to execute a workflow for an incident.
count [required]The maximum number of workflow executions.
incidentTypeThe type of incident that triggers the workflow.
serialExecutionWhether to execute the workflow serially for an incident.
enabled [required]Whether serial execution is enabled.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 17Schema for an incident schedule trigger.
incidentScheduleTrigger [required]Trigger a workflow on a schedule for an incident.
incidentTypeThe type of incident that triggers the workflow.
rrule [required]The recurrence rule for the schedule, expressed as an iCalendar RRULE string.
tagConditionConditions that determine which incidents trigger the workflow.
tagValuesIncident tags and values used to filter matching incidents.
tag [required]The incident tag to match.
values [required]The accepted values for the incident tag.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 18Schema for an incident-based trigger.
incidentTrigger [required]Trigger a workflow from an incident. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
versionVersion of the incident manual trigger.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 19Schema for a Monitor-based trigger.
monitorTrigger [required]Trigger a workflow from a Monitor. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 20Schema for a Notebook-based trigger.
notebookTrigger [required]Trigger a workflow from a Notebook.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 21Schema for an On-Call shift change trigger.
onCallShiftChangeTrigger [required]Trigger a workflow when an On-Call shift changes. The workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 22Schema for an On-Call-based trigger.
onCallTrigger [required]Trigger a workflow from an On-Call Page or On-Call Handover. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 23Schema for a Schedule-based trigger.
scheduleTrigger [required]Trigger a workflow from a Schedule. The workflow must be published.
overlapBehaviorControls whether a scheduled workflow run may start while another instance is still running.
EXCLUSIVE_RUNEXCLUSIVE_RUN, OVERLAP_ALLOWEDrruleExpression [required]Recurrence rule expression for scheduling.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 24Schema for a Security-based trigger.
securityTrigger [required]Trigger a workflow from a Security Signal or Finding. For automatic triggering a handle must be configured and the workflow must be published.
rateLimitDefines a rate limit for a trigger.
countThe TriggerRateLimit count.
intervalThe TriggerRateLimit interval. The expected format is the number of seconds ending with an s. For example, 1 day is 86400s
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 25Schema for a Self Service-based trigger.
selfServiceTrigger [required]Trigger a workflow from Self Service.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 26Schema for a Slack-based trigger.
slackTrigger [required]Trigger a workflow from Slack. The workflow must be published.
reactionTriggersSlack emoji reactions that trigger the workflow.
reactionEmoji [required]The Slack emoji reaction name.
teamId [required]The Slack workspace ID.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 27Schema for a Software Catalog-based trigger.
softwareCatalogTrigger [required]Trigger a workflow from Software Catalog.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
Object 28Schema for a Workflow-based trigger.
startStepNamesNames of existing workflow steps that run first after a trigger fires.
workflowTrigger [required]Trigger a workflow from the Datadog UI. When present, this must be the workflow's only trigger.
tagsTags of the workflow.
updatedAtWhen the workflow was last updated.
idThe workflow identifier
relationshipsThe definition of WorkflowDataRelationships object.
creatorThe definition of WorkflowUserRelationship object.
dataThe definition of WorkflowUserRelationshipData object.
id [required]The user identifier
type [required]The definition of WorkflowUserRelationshipType object.
usersownerThe definition of WorkflowUserRelationship object.
dataThe definition of WorkflowUserRelationshipData object.
id [required]The user identifier
type [required]The definition of WorkflowUserRelationshipType object.
usersrunAsThe service account used to run the workflow. Present when runAsUserMode is service_account.
dataThe definition of WorkflowUserRelationshipData object.
id [required]The user identifier
type [required]The definition of WorkflowUserRelationshipType object.
userstype [required]The definition of WorkflowDataType object.
workflows{
"data": {
"attributes": {
"createdAt": "2019-09-19T10:00:00.000Z",
"description": "string",
"name": "string",
"published": false,
"runAsUserMode": "owner",
"sensitivePrivileges": false,
"spec": {
"annotations": [
{
"display": {
"bounds": {
"height": "number",
"width": "number",
"x": "number",
"y": "number"
}
},
"id": "",
"markdownTextAnnotation": {
"text": "string"
}
}
],
"connectionEnvs": [
{
"connectionGroups": [
{
"connectionGroupId": "",
"label": "",
"tags": [
""
]
}
],
"connections": [
{
"connectionId": "",
"label": ""
}
],
"env": "default"
}
],
"handle": "string",
"inputSchema": {
"parameters": [
{
"allowExtraValues": false,
"allowedValues": "undefined",
"defaultValue": "undefined",
"description": "string",
"label": "string",
"name": "",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"defaultValue": "undefined",
"description": "string",
"label": "string",
"name": "",
"type": "STRING",
"value": "undefined"
}
]
},
"steps": [
{
"actionId": "",
"completionGate": {
"completionCondition": {
"operand1": "undefined",
"operand2": "undefined",
"operator": "OPERATOR_EQUAL"
},
"retryStrategy": {
"kind": "RETRY_STRATEGY_LINEAR",
"linear": {
"interval": "",
"maxRetries": 0
}
}
},
"connectionLabel": "string",
"display": {
"bounds": {
"x": "number",
"y": "number"
}
},
"errorHandlers": [
{
"fallbackStepName": "",
"retryStrategy": {
"kind": "RETRY_STRATEGY_LINEAR",
"linear": {
"interval": "",
"maxRetries": 0
}
}
}
],
"name": "",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "",
"value": "undefined"
}
],
"readinessGate": {
"thresholdType": "ANY"
}
}
],
"triggers": [
{
"agentTrigger": {
"rateLimit": {
"count": "integer",
"interval": "string"
}
},
"startStepNames": [
""
]
}
]
},
"tags": [],
"updatedAt": "2019-09-19T10:00:00.000Z"
},
"id": "string",
"relationships": {
"creator": {
"data": {
"id": "",
"type": "users"
}
},
"owner": {
"data": {
"id": "",
"type": "users"
}
},
"runAs": {
"data": {
"id": "",
"type": "users"
}
}
},
"type": "workflows"
}
}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"
}
]
}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.
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"
}
]
}コード例
# Path parameters
export workflow_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/workflows/${workflow_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "A sample workflow.",
"name": "Example Workflow",
"published": true,
"runAs": {
"type": "owner"
},
"sensitivePrivileges": false,
"spec": {
"connectionEnvs": [
{
"connections": [
{
"connectionId": "e1e64943-c7c5-4487-aece-25aaec7d3aad",
"label": "INTEGRATION_DATADOG"
}
],
"env": "default"
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "default",
"name": "input",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "outputValue"
}
]
},
"steps": [
{
"actionId": "com.datadoghq.dd.monitor.listMonitors",
"connectionLabel": "INTEGRATION_DATADOG",
"name": "Step1",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "tags",
"value": "service:monitoring"
}
]
},
{
"actionId": "com.datadoghq.core.noop",
"name": "Step2"
}
],
"triggers": [
{
"monitorTrigger": {
"rateLimit": {
"count": 1,
"interval": "3600s"
}
},
"startStepNames": [
"Step1"
]
},
{
"startStepNames": [
"Step1"
],
"githubWebhookTrigger": {}
}
]
},
"tags": [
"team:infra",
"service:monitoring",
"foo:bar"
]
},
"id": "22222222-2222-2222-2222-222222222222",
"type": "workflows"
}
}
EOF# Path parameters
export workflow_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/workflows/${workflow_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "A sample workflow.",
"name": "Example Workflow",
"published": true,
"runAs": {
"type": "owner"
},
"sensitivePrivileges": false,
"spec": {
"connectionEnvs": [
{
"connections": [
{
"connectionId": "e1e64943-c7c5-4487-aece-25aaec7d3aad",
"label": "INTEGRATION_DATADOG"
}
],
"env": "default"
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "default",
"name": "input",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "outputValue"
}
]
},
"steps": [
{
"actionId": "com.datadoghq.dd.monitor.listMonitors",
"connectionLabel": "INTEGRATION_DATADOG",
"name": "Step1",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "tags",
"value": "service:monitoring"
}
]
},
{
"actionId": "com.datadoghq.core.noop",
"name": "Step2"
}
],
"triggers": [
{
"monitorTrigger": {
"rateLimit": {
"count": 1,
"interval": "3600s"
}
},
"startStepNames": [
"Step1"
]
},
{
"startStepNames": [
"Step1"
],
"githubWebhookTrigger": {}
}
]
},
"tags": [
"team:infra",
"service:monitoring",
"foo:bar"
]
},
"id": "22222222-2222-2222-2222-222222222222",
"type": "workflows"
}
}
EOF# Path parameters
export workflow_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/workflows/${workflow_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "A sample workflow.",
"name": "Example Workflow",
"published": true,
"runAs": {
"type": "owner"
},
"sensitivePrivileges": false,
"spec": {
"connectionEnvs": [
{
"connections": [
{
"connectionId": "e1e64943-c7c5-4487-aece-25aaec7d3aad",
"label": "INTEGRATION_DATADOG"
}
],
"env": "default"
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "default",
"name": "input",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "outputValue"
}
]
},
"steps": [
{
"actionId": "com.datadoghq.dd.monitor.listMonitors",
"connectionLabel": "INTEGRATION_DATADOG",
"name": "Step1",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "tags",
"value": "service:monitoring"
}
]
},
{
"actionId": "com.datadoghq.core.noop",
"name": "Step2"
}
],
"triggers": [
{
"monitorTrigger": {
"rateLimit": {
"count": 1,
"interval": "3600s"
}
},
"startStepNames": [
"Step1"
]
},
{
"startStepNames": [
"Step1"
],
"githubWebhookTrigger": {}
}
]
},
"tags": [
"team:infra",
"service:monitoring",
"foo:bar"
]
},
"id": "22222222-2222-2222-2222-222222222222",
"type": "workflows"
}
}
EOF# Path parameters
export workflow_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/workflows/${workflow_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "A sample workflow.",
"name": "Example Workflow",
"published": true,
"runAs": {
"type": "owner"
},
"sensitivePrivileges": false,
"spec": {
"connectionEnvs": [
{
"connections": [
{
"connectionId": "e1e64943-c7c5-4487-aece-25aaec7d3aad",
"label": "INTEGRATION_DATADOG"
}
],
"env": "default"
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "default",
"name": "input",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "outputValue"
}
]
},
"steps": [
{
"actionId": "com.datadoghq.dd.monitor.listMonitors",
"connectionLabel": "INTEGRATION_DATADOG",
"name": "Step1",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "tags",
"value": "service:monitoring"
}
]
},
{
"actionId": "com.datadoghq.core.noop",
"name": "Step2"
}
],
"triggers": [
{
"monitorTrigger": {
"rateLimit": {
"count": 1,
"interval": "3600s"
}
},
"startStepNames": [
"Step1"
]
},
{
"startStepNames": [
"Step1"
],
"githubWebhookTrigger": {}
}
]
},
"tags": [
"team:infra",
"service:monitoring",
"foo:bar"
]
},
"id": "22222222-2222-2222-2222-222222222222",
"type": "workflows"
}
}
EOF# Path parameters
export workflow_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/workflows/${workflow_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "A sample workflow.",
"name": "Example Workflow",
"published": true,
"runAs": {
"type": "owner"
},
"sensitivePrivileges": false,
"spec": {
"connectionEnvs": [
{
"connections": [
{
"connectionId": "e1e64943-c7c5-4487-aece-25aaec7d3aad",
"label": "INTEGRATION_DATADOG"
}
],
"env": "default"
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "default",
"name": "input",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "outputValue"
}
]
},
"steps": [
{
"actionId": "com.datadoghq.dd.monitor.listMonitors",
"connectionLabel": "INTEGRATION_DATADOG",
"name": "Step1",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "tags",
"value": "service:monitoring"
}
]
},
{
"actionId": "com.datadoghq.core.noop",
"name": "Step2"
}
],
"triggers": [
{
"monitorTrigger": {
"rateLimit": {
"count": 1,
"interval": "3600s"
}
},
"startStepNames": [
"Step1"
]
},
{
"startStepNames": [
"Step1"
],
"githubWebhookTrigger": {}
}
]
},
"tags": [
"team:infra",
"service:monitoring",
"foo:bar"
]
},
"id": "22222222-2222-2222-2222-222222222222",
"type": "workflows"
}
}
EOF# Path parameters
export workflow_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/workflows/${workflow_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "A sample workflow.",
"name": "Example Workflow",
"published": true,
"runAs": {
"type": "owner"
},
"sensitivePrivileges": false,
"spec": {
"connectionEnvs": [
{
"connections": [
{
"connectionId": "e1e64943-c7c5-4487-aece-25aaec7d3aad",
"label": "INTEGRATION_DATADOG"
}
],
"env": "default"
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "default",
"name": "input",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "outputValue"
}
]
},
"steps": [
{
"actionId": "com.datadoghq.dd.monitor.listMonitors",
"connectionLabel": "INTEGRATION_DATADOG",
"name": "Step1",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "tags",
"value": "service:monitoring"
}
]
},
{
"actionId": "com.datadoghq.core.noop",
"name": "Step2"
}
],
"triggers": [
{
"monitorTrigger": {
"rateLimit": {
"count": 1,
"interval": "3600s"
}
},
"startStepNames": [
"Step1"
]
},
{
"startStepNames": [
"Step1"
],
"githubWebhookTrigger": {}
}
]
},
"tags": [
"team:infra",
"service:monitoring",
"foo:bar"
]
},
"id": "22222222-2222-2222-2222-222222222222",
"type": "workflows"
}
}
EOF# Path parameters
export workflow_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/workflows/${workflow_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "A sample workflow.",
"name": "Example Workflow",
"published": true,
"runAs": {
"type": "owner"
},
"sensitivePrivileges": false,
"spec": {
"connectionEnvs": [
{
"connections": [
{
"connectionId": "e1e64943-c7c5-4487-aece-25aaec7d3aad",
"label": "INTEGRATION_DATADOG"
}
],
"env": "default"
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "default",
"name": "input",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "outputValue"
}
]
},
"steps": [
{
"actionId": "com.datadoghq.dd.monitor.listMonitors",
"connectionLabel": "INTEGRATION_DATADOG",
"name": "Step1",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "tags",
"value": "service:monitoring"
}
]
},
{
"actionId": "com.datadoghq.core.noop",
"name": "Step2"
}
],
"triggers": [
{
"monitorTrigger": {
"rateLimit": {
"count": 1,
"interval": "3600s"
}
},
"startStepNames": [
"Step1"
]
},
{
"startStepNames": [
"Step1"
],
"githubWebhookTrigger": {}
}
]
},
"tags": [
"team:infra",
"service:monitoring",
"foo:bar"
]
},
"id": "22222222-2222-2222-2222-222222222222",
"type": "workflows"
}
}
EOF# Path parameters
export workflow_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/workflows/${workflow_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "A sample workflow.",
"name": "Example Workflow",
"published": true,
"runAs": {
"type": "owner"
},
"sensitivePrivileges": false,
"spec": {
"connectionEnvs": [
{
"connections": [
{
"connectionId": "e1e64943-c7c5-4487-aece-25aaec7d3aad",
"label": "INTEGRATION_DATADOG"
}
],
"env": "default"
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "default",
"name": "input",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "outputValue"
}
]
},
"steps": [
{
"actionId": "com.datadoghq.dd.monitor.listMonitors",
"connectionLabel": "INTEGRATION_DATADOG",
"name": "Step1",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "tags",
"value": "service:monitoring"
}
]
},
{
"actionId": "com.datadoghq.core.noop",
"name": "Step2"
}
],
"triggers": [
{
"monitorTrigger": {
"rateLimit": {
"count": 1,
"interval": "3600s"
}
},
"startStepNames": [
"Step1"
]
},
{
"startStepNames": [
"Step1"
],
"githubWebhookTrigger": {}
}
]
},
"tags": [
"team:infra",
"service:monitoring",
"foo:bar"
]
},
"id": "22222222-2222-2222-2222-222222222222",
"type": "workflows"
}
}
EOF# Path parameters
export workflow_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/workflows/${workflow_id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
"data": {
"attributes": {
"description": "A sample workflow.",
"name": "Example Workflow",
"published": true,
"runAs": {
"type": "owner"
},
"sensitivePrivileges": false,
"spec": {
"connectionEnvs": [
{
"connections": [
{
"connectionId": "e1e64943-c7c5-4487-aece-25aaec7d3aad",
"label": "INTEGRATION_DATADOG"
}
],
"env": "default"
}
],
"inputSchema": {
"parameters": [
{
"defaultValue": "default",
"name": "input",
"type": "STRING"
}
]
},
"outputSchema": {
"parameters": [
{
"name": "output",
"type": "ARRAY_OBJECT",
"value": "outputValue"
}
]
},
"steps": [
{
"actionId": "com.datadoghq.dd.monitor.listMonitors",
"connectionLabel": "INTEGRATION_DATADOG",
"name": "Step1",
"outboundEdges": [
{
"branchName": "main",
"nextStepName": "Step2"
}
],
"parameters": [
{
"name": "tags",
"value": "service:monitoring"
}
]
},
{
"actionId": "com.datadoghq.core.noop",
"name": "Step2"
}
],
"triggers": [
{
"monitorTrigger": {
"rateLimit": {
"count": 1,
"interval": "3600s"
}
},
"startStepNames": [
"Step1"
]
},
{
"startStepNames": [
"Step1"
],
"githubWebhookTrigger": {}
}
]
},
"tags": [
"team:infra",
"service:monitoring",
"foo:bar"
]
},
"id": "22222222-2222-2222-2222-222222222222",
"type": "workflows"
}
}
EOF// Update an existing Workflow returns "Successfully updated a workflow." 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 "workflow" in the system
WorkflowDataID := os.Getenv("WORKFLOW_DATA_ID")
body := datadogV2.UpdateWorkflowRequest{
Data: datadogV2.WorkflowDataUpdate{
Attributes: datadogV2.WorkflowDataUpdateAttributes{
Description: datadog.PtrString("A sample workflow."),
Name: datadog.PtrString("Example Workflow"),
Published: datadog.PtrBool(true),
RunAs: &datadogV2.WorkflowRunAs{
WorkflowRunAsOwner: &datadogV2.WorkflowRunAsOwner{
Type: datadogV2.WORKFLOWRUNASOWNERTYPE_OWNER,
}},
SensitivePrivileges: datadog.PtrBool(false),
Spec: &datadogV2.Spec{
ConnectionEnvs: []datadogV2.ConnectionEnv{
{
Connections: []datadogV2.Connection{
{
ConnectionId: "e1e64943-c7c5-4487-aece-25aaec7d3aad",
Label: "INTEGRATION_DATADOG",
},
},
Env: datadogV2.CONNECTIONENVENV_DEFAULT,
},
},
InputSchema: &datadogV2.InputSchema{
Parameters: []datadogV2.InputSchemaParameters{
{
DefaultValue: "default",
Name: "input",
Type: datadogV2.INPUTSCHEMAPARAMETERSTYPE_STRING,
},
},
},
OutputSchema: &datadogV2.OutputSchema{
Parameters: []datadogV2.OutputSchemaParameters{
{
Name: "output",
Type: datadogV2.OUTPUTSCHEMAPARAMETERSTYPE_ARRAY_OBJECT,
Value: "outputValue",
},
},
},
Steps: []datadogV2.Step{
{
ActionId: "com.datadoghq.dd.monitor.listMonitors",
ConnectionLabel: datadog.PtrString("INTEGRATION_DATADOG"),
Name: "Step1",
OutboundEdges: []datadogV2.OutboundEdge{
{
BranchName: "main",
NextStepName: "Step2",
},
},
Parameters: []datadogV2.Parameter{
{
Name: "tags",
Value: "service:monitoring",
},
},
},
{
ActionId: "com.datadoghq.core.noop",
Name: "Step2",
},
},
Triggers: []datadogV2.Trigger{
datadogV2.Trigger{
MonitorTriggerWrapper: &datadogV2.MonitorTriggerWrapper{
MonitorTrigger: datadogV2.MonitorTrigger{
RateLimit: &datadogV2.TriggerRateLimit{
Count: datadog.PtrInt64(1),
Interval: datadog.PtrString("3600s"),
},
},
StartStepNames: []string{
"Step1",
},
}},
datadogV2.Trigger{
GithubWebhookTriggerWrapper: &datadogV2.GithubWebhookTriggerWrapper{
StartStepNames: []string{
"Step1",
},
GithubWebhookTrigger: datadogV2.GithubWebhookTrigger{},
}},
},
},
Tags: []string{
"team:infra",
"service:monitoring",
"foo:bar",
},
},
Id: datadog.PtrString("22222222-2222-2222-2222-222222222222"),
Type: datadogV2.WORKFLOWDATATYPE_WORKFLOWS,
},
}
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.NewWorkflowAutomationApi(apiClient)
resp, r, err := api.UpdateWorkflow(ctx, WorkflowDataID, body)
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `WorkflowAutomationApi.UpdateWorkflow`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `WorkflowAutomationApi.UpdateWorkflow`:\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 an existing Workflow returns "Successfully updated a workflow." response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.WorkflowAutomationApi;
import com.datadog.api.client.v2.model.Connection;
import com.datadog.api.client.v2.model.ConnectionEnv;
import com.datadog.api.client.v2.model.ConnectionEnvEnv;
import com.datadog.api.client.v2.model.GithubWebhookTrigger;
import com.datadog.api.client.v2.model.GithubWebhookTriggerWrapper;
import com.datadog.api.client.v2.model.InputSchema;
import com.datadog.api.client.v2.model.InputSchemaParameters;
import com.datadog.api.client.v2.model.InputSchemaParametersType;
import com.datadog.api.client.v2.model.MonitorTrigger;
import com.datadog.api.client.v2.model.MonitorTriggerWrapper;
import com.datadog.api.client.v2.model.OutboundEdge;
import com.datadog.api.client.v2.model.OutputSchema;
import com.datadog.api.client.v2.model.OutputSchemaParameters;
import com.datadog.api.client.v2.model.OutputSchemaParametersType;
import com.datadog.api.client.v2.model.Parameter;
import com.datadog.api.client.v2.model.Spec;
import com.datadog.api.client.v2.model.Step;
import com.datadog.api.client.v2.model.Trigger;
import com.datadog.api.client.v2.model.TriggerRateLimit;
import com.datadog.api.client.v2.model.UpdateWorkflowRequest;
import com.datadog.api.client.v2.model.UpdateWorkflowResponse;
import com.datadog.api.client.v2.model.WorkflowDataType;
import com.datadog.api.client.v2.model.WorkflowDataUpdate;
import com.datadog.api.client.v2.model.WorkflowDataUpdateAttributes;
import com.datadog.api.client.v2.model.WorkflowRunAs;
import com.datadog.api.client.v2.model.WorkflowRunAsOwner;
import com.datadog.api.client.v2.model.WorkflowRunAsOwnerType;
import java.util.Arrays;
import java.util.Collections;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
WorkflowAutomationApi apiInstance = new WorkflowAutomationApi(defaultClient);
// there is a valid "workflow" in the system
String WORKFLOW_DATA_ID = System.getenv("WORKFLOW_DATA_ID");
UpdateWorkflowRequest body =
new UpdateWorkflowRequest()
.data(
new WorkflowDataUpdate()
.attributes(
new WorkflowDataUpdateAttributes()
.description("A sample workflow.")
.name("Example Workflow")
.published(true)
.runAs(
new WorkflowRunAs(
new WorkflowRunAsOwner().type(WorkflowRunAsOwnerType.OWNER)))
.sensitivePrivileges(false)
.spec(
new Spec()
.connectionEnvs(
Collections.singletonList(
new ConnectionEnv()
.connections(
Collections.singletonList(
new Connection()
.connectionId(
"e1e64943-c7c5-4487-aece-25aaec7d3aad")
.label("INTEGRATION_DATADOG")))
.env(ConnectionEnvEnv.DEFAULT)))
.inputSchema(
new InputSchema()
.parameters(
Collections.singletonList(
new InputSchemaParameters()
.defaultValue("default")
.name("input")
.type(InputSchemaParametersType.STRING))))
.outputSchema(
new OutputSchema()
.parameters(
Collections.singletonList(
new OutputSchemaParameters()
.name("output")
.type(
OutputSchemaParametersType.ARRAY_OBJECT)
.value("outputValue"))))
.steps(
Arrays.asList(
new Step()
.actionId("com.datadoghq.dd.monitor.listMonitors")
.connectionLabel("INTEGRATION_DATADOG")
.name("Step1")
.outboundEdges(
Collections.singletonList(
new OutboundEdge()
.branchName("main")
.nextStepName("Step2")))
.parameters(
Collections.singletonList(
new Parameter()
.name("tags")
.value("service:monitoring"))),
new Step()
.actionId("com.datadoghq.core.noop")
.name("Step2")))
.triggers(
Arrays.asList(
new Trigger(
new MonitorTriggerWrapper()
.monitorTrigger(
new MonitorTrigger()
.rateLimit(
new TriggerRateLimit()
.count(1L)
.interval("3600s")))
.startStepNames(
Collections.singletonList("Step1"))),
new Trigger(
new GithubWebhookTriggerWrapper()
.startStepNames(
Collections.singletonList("Step1"))
.githubWebhookTrigger(
new GithubWebhookTrigger())))))
.tags(Arrays.asList("team:infra", "service:monitoring", "foo:bar")))
.id("22222222-2222-2222-2222-222222222222")
.type(WorkflowDataType.WORKFLOWS));
try {
UpdateWorkflowResponse result = apiInstance.updateWorkflow(WORKFLOW_DATA_ID, body);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WorkflowAutomationApi#updateWorkflow");
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 an existing Workflow returns "Successfully updated a workflow." response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi
from datadog_api_client.v2.model.connection import Connection
from datadog_api_client.v2.model.connection_env import ConnectionEnv
from datadog_api_client.v2.model.connection_env_env import ConnectionEnvEnv
from datadog_api_client.v2.model.github_webhook_trigger import GithubWebhookTrigger
from datadog_api_client.v2.model.github_webhook_trigger_wrapper import GithubWebhookTriggerWrapper
from datadog_api_client.v2.model.input_schema import InputSchema
from datadog_api_client.v2.model.input_schema_parameters import InputSchemaParameters
from datadog_api_client.v2.model.input_schema_parameters_type import InputSchemaParametersType
from datadog_api_client.v2.model.monitor_trigger import MonitorTrigger
from datadog_api_client.v2.model.monitor_trigger_wrapper import MonitorTriggerWrapper
from datadog_api_client.v2.model.outbound_edge import OutboundEdge
from datadog_api_client.v2.model.output_schema import OutputSchema
from datadog_api_client.v2.model.output_schema_parameters import OutputSchemaParameters
from datadog_api_client.v2.model.output_schema_parameters_type import OutputSchemaParametersType
from datadog_api_client.v2.model.parameter import Parameter
from datadog_api_client.v2.model.spec import Spec
from datadog_api_client.v2.model.step import Step
from datadog_api_client.v2.model.trigger_rate_limit import TriggerRateLimit
from datadog_api_client.v2.model.update_workflow_request import UpdateWorkflowRequest
from datadog_api_client.v2.model.workflow_data_type import WorkflowDataType
from datadog_api_client.v2.model.workflow_data_update import WorkflowDataUpdate
from datadog_api_client.v2.model.workflow_data_update_attributes import WorkflowDataUpdateAttributes
from datadog_api_client.v2.model.workflow_run_as_owner import WorkflowRunAsOwner
from datadog_api_client.v2.model.workflow_run_as_owner_type import WorkflowRunAsOwnerType
# there is a valid "workflow" in the system
WORKFLOW_DATA_ID = environ["WORKFLOW_DATA_ID"]
body = UpdateWorkflowRequest(
data=WorkflowDataUpdate(
attributes=WorkflowDataUpdateAttributes(
description="A sample workflow.",
name="Example Workflow",
published=True,
run_as=WorkflowRunAsOwner(
type=WorkflowRunAsOwnerType.OWNER,
),
sensitive_privileges=False,
spec=Spec(
connection_envs=[
ConnectionEnv(
connections=[
Connection(
connection_id="e1e64943-c7c5-4487-aece-25aaec7d3aad",
label="INTEGRATION_DATADOG",
),
],
env=ConnectionEnvEnv.DEFAULT,
),
],
input_schema=InputSchema(
parameters=[
InputSchemaParameters(
default_value="default",
name="input",
type=InputSchemaParametersType.STRING,
),
],
),
output_schema=OutputSchema(
parameters=[
OutputSchemaParameters(
name="output",
type=OutputSchemaParametersType.ARRAY_OBJECT,
value="outputValue",
),
],
),
steps=[
Step(
action_id="com.datadoghq.dd.monitor.listMonitors",
connection_label="INTEGRATION_DATADOG",
name="Step1",
outbound_edges=[
OutboundEdge(
branch_name="main",
next_step_name="Step2",
),
],
parameters=[
Parameter(
name="tags",
value="service:monitoring",
),
],
),
Step(
action_id="com.datadoghq.core.noop",
name="Step2",
),
],
triggers=[
MonitorTriggerWrapper(
monitor_trigger=MonitorTrigger(
rate_limit=TriggerRateLimit(
count=1,
interval="3600s",
),
),
start_step_names=[
"Step1",
],
),
GithubWebhookTriggerWrapper(
start_step_names=[
"Step1",
],
github_webhook_trigger=GithubWebhookTrigger(),
),
],
),
tags=[
"team:infra",
"service:monitoring",
"foo:bar",
],
),
id="22222222-2222-2222-2222-222222222222",
type=WorkflowDataType.WORKFLOWS,
),
)
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
with ApiClient(configuration) as api_client:
api_instance = WorkflowAutomationApi(api_client)
response = api_instance.update_workflow(workflow_id=WORKFLOW_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 an existing Workflow returns "Successfully updated a workflow." response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::WorkflowAutomationAPI.new
# there is a valid "workflow" in the system
WORKFLOW_DATA_ID = ENV["WORKFLOW_DATA_ID"]
body = DatadogAPIClient::V2::UpdateWorkflowRequest.new({
data: DatadogAPIClient::V2::WorkflowDataUpdate.new({
attributes: DatadogAPIClient::V2::WorkflowDataUpdateAttributes.new({
description: "A sample workflow.",
name: "Example Workflow",
published: true,
run_as: DatadogAPIClient::V2::WorkflowRunAsOwner.new({
type: DatadogAPIClient::V2::WorkflowRunAsOwnerType::OWNER,
}),
sensitive_privileges: false,
spec: DatadogAPIClient::V2::Spec.new({
connection_envs: [
DatadogAPIClient::V2::ConnectionEnv.new({
connections: [
DatadogAPIClient::V2::Connection.new({
connection_id: "e1e64943-c7c5-4487-aece-25aaec7d3aad",
label: "INTEGRATION_DATADOG",
}),
],
env: DatadogAPIClient::V2::ConnectionEnvEnv::DEFAULT,
}),
],
input_schema: DatadogAPIClient::V2::InputSchema.new({
parameters: [
DatadogAPIClient::V2::InputSchemaParameters.new({
default_value: "default",
name: "input",
type: DatadogAPIClient::V2::InputSchemaParametersType::STRING,
}),
],
}),
output_schema: DatadogAPIClient::V2::OutputSchema.new({
parameters: [
DatadogAPIClient::V2::OutputSchemaParameters.new({
name: "output",
type: DatadogAPIClient::V2::OutputSchemaParametersType::ARRAY_OBJECT,
value: "outputValue",
}),
],
}),
steps: [
DatadogAPIClient::V2::Step.new({
action_id: "com.datadoghq.dd.monitor.listMonitors",
connection_label: "INTEGRATION_DATADOG",
name: "Step1",
outbound_edges: [
DatadogAPIClient::V2::OutboundEdge.new({
branch_name: "main",
next_step_name: "Step2",
}),
],
parameters: [
DatadogAPIClient::V2::Parameter.new({
name: "tags",
value: "service:monitoring",
}),
],
}),
DatadogAPIClient::V2::Step.new({
action_id: "com.datadoghq.core.noop",
name: "Step2",
}),
],
triggers: [
DatadogAPIClient::V2::MonitorTriggerWrapper.new({
monitor_trigger: DatadogAPIClient::V2::MonitorTrigger.new({
rate_limit: DatadogAPIClient::V2::TriggerRateLimit.new({
count: 1,
interval: "3600s",
}),
}),
start_step_names: [
"Step1",
],
}),
DatadogAPIClient::V2::GithubWebhookTriggerWrapper.new({
start_step_names: [
"Step1",
],
github_webhook_trigger: DatadogAPIClient::V2::GithubWebhookTrigger.new({}),
}),
],
}),
tags: [
"team:infra",
"service:monitoring",
"foo:bar",
],
}),
id: "22222222-2222-2222-2222-222222222222",
type: DatadogAPIClient::V2::WorkflowDataType::WORKFLOWS,
}),
})
p api_instance.update_workflow(WORKFLOW_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 an existing Workflow returns "Successfully updated a workflow." response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_workflow_automation::WorkflowAutomationAPI;
use datadog_api_client::datadogV2::model::Connection;
use datadog_api_client::datadogV2::model::ConnectionEnv;
use datadog_api_client::datadogV2::model::ConnectionEnvEnv;
use datadog_api_client::datadogV2::model::GithubWebhookTrigger;
use datadog_api_client::datadogV2::model::GithubWebhookTriggerWrapper;
use datadog_api_client::datadogV2::model::InputSchema;
use datadog_api_client::datadogV2::model::InputSchemaParameters;
use datadog_api_client::datadogV2::model::InputSchemaParametersType;
use datadog_api_client::datadogV2::model::MonitorTrigger;
use datadog_api_client::datadogV2::model::MonitorTriggerWrapper;
use datadog_api_client::datadogV2::model::OutboundEdge;
use datadog_api_client::datadogV2::model::OutputSchema;
use datadog_api_client::datadogV2::model::OutputSchemaParameters;
use datadog_api_client::datadogV2::model::OutputSchemaParametersType;
use datadog_api_client::datadogV2::model::Parameter;
use datadog_api_client::datadogV2::model::Spec;
use datadog_api_client::datadogV2::model::Step;
use datadog_api_client::datadogV2::model::Trigger;
use datadog_api_client::datadogV2::model::TriggerRateLimit;
use datadog_api_client::datadogV2::model::UpdateWorkflowRequest;
use datadog_api_client::datadogV2::model::WorkflowDataType;
use datadog_api_client::datadogV2::model::WorkflowDataUpdate;
use datadog_api_client::datadogV2::model::WorkflowDataUpdateAttributes;
use datadog_api_client::datadogV2::model::WorkflowRunAs;
use datadog_api_client::datadogV2::model::WorkflowRunAsOwner;
use datadog_api_client::datadogV2::model::WorkflowRunAsOwnerType;
use serde_json::Value;
#[tokio::main]
async fn main() {
// there is a valid "workflow" in the system
let workflow_data_id = std::env::var("WORKFLOW_DATA_ID").unwrap();
let body = UpdateWorkflowRequest::new(
WorkflowDataUpdate::new(
WorkflowDataUpdateAttributes::new()
.description("A sample workflow.".to_string())
.name("Example Workflow".to_string())
.published(true)
.run_as(WorkflowRunAs::WorkflowRunAsOwner(Box::new(
WorkflowRunAsOwner::new(WorkflowRunAsOwnerType::OWNER),
)))
.sensitive_privileges(false)
.spec(
Spec::new()
.connection_envs(vec![ConnectionEnv::new(ConnectionEnvEnv::DEFAULT)
.connections(vec![Connection::new(
"e1e64943-c7c5-4487-aece-25aaec7d3aad".to_string(),
"INTEGRATION_DATADOG".to_string(),
)])])
.input_schema(InputSchema::new().parameters(vec![
InputSchemaParameters::new(
"input".to_string(),
InputSchemaParametersType::STRING,
).default_value(Value::from("default"))
]))
.output_schema(OutputSchema::new().parameters(vec![
OutputSchemaParameters::new(
"output".to_string(),
OutputSchemaParametersType::ARRAY_OBJECT,
).value(Value::from("outputValue"))
]))
.steps(vec![
Step::new(
"com.datadoghq.dd.monitor.listMonitors".to_string(),
"Step1".to_string(),
)
.connection_label("INTEGRATION_DATADOG".to_string())
.outbound_edges(vec![OutboundEdge::new(
"main".to_string(),
"Step2".to_string(),
)])
.parameters(vec![Parameter::new(
"tags".to_string(),
Value::from("service:monitoring"),
)]),
Step::new("com.datadoghq.core.noop".to_string(), "Step2".to_string()),
])
.triggers(vec![
Trigger::MonitorTriggerWrapper(Box::new(
MonitorTriggerWrapper::new(
MonitorTrigger::new().rate_limit(
TriggerRateLimit::new()
.count(1)
.interval("3600s".to_string()),
),
)
.start_step_names(vec!["Step1".to_string()]),
)),
Trigger::GithubWebhookTriggerWrapper(Box::new(
GithubWebhookTriggerWrapper::new(GithubWebhookTrigger::new())
.start_step_names(vec!["Step1".to_string()]),
)),
]),
)
.tags(vec![
"team:infra".to_string(),
"service:monitoring".to_string(),
"foo:bar".to_string(),
]),
WorkflowDataType::WORKFLOWS,
)
.id("22222222-2222-2222-2222-222222222222".to_string()),
);
let configuration = datadog::Configuration::new();
let api = WorkflowAutomationAPI::with_config(configuration);
let resp = api.update_workflow(workflow_data_id.clone(), 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 an existing Workflow returns "Successfully updated a workflow." 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.WorkflowAutomationApi(configuration);
// there is a valid "workflow" in the system
const WORKFLOW_DATA_ID = process.env.WORKFLOW_DATA_ID as string;
const params: v2.WorkflowAutomationApiUpdateWorkflowRequest = {
body: {
data: {
attributes: {
description: "A sample workflow.",
name: "Example Workflow",
published: true,
runAs: {
type: "owner",
},
sensitivePrivileges: false,
spec: {
connectionEnvs: [
{
connections: [
{
connectionId: "e1e64943-c7c5-4487-aece-25aaec7d3aad",
label: "INTEGRATION_DATADOG",
},
],
env: "default",
},
],
inputSchema: {
parameters: [
{
defaultValue: "default",
name: "input",
type: "STRING",
},
],
},
outputSchema: {
parameters: [
{
name: "output",
type: "ARRAY_OBJECT",
value: "outputValue",
},
],
},
steps: [
{
actionId: "com.datadoghq.dd.monitor.listMonitors",
connectionLabel: "INTEGRATION_DATADOG",
name: "Step1",
outboundEdges: [
{
branchName: "main",
nextStepName: "Step2",
},
],
parameters: [
{
name: "tags",
value: "service:monitoring",
},
],
},
{
actionId: "com.datadoghq.core.noop",
name: "Step2",
},
],
triggers: [
{
monitorTrigger: {
rateLimit: {
count: 1,
interval: "3600s",
},
},
startStepNames: ["Step1"],
},
{
startStepNames: ["Step1"],
githubWebhookTrigger: {},
},
],
},
tags: ["team:infra", "service:monitoring", "foo:bar"],
},
id: "22222222-2222-2222-2222-222222222222",
type: "workflows",
},
},
workflowId: WORKFLOW_DATA_ID,
};
apiInstance
.updateWorkflow(params)
.then((data: v2.UpdateWorkflowResponse) => {
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"