workflows.update
Note: This method is only available to Fabric customers.
Update a Self Service Workflow. Only the arguments you send are changed. Anything you leave out keeps its current value.
When called with a personal access token, the issuing user must be a Self-Service Admin. Organization tokens with the workflows:manage scope are also accepted.
See the workflows.create method for the full description of each workflow argument, and workflows.list to see a workflow’s current values.
Facts
| Method | POST https://api.getdx.com/workflows.update |
| Required scope | workflows:manage |
Arguments
Required arguments
| Name | Type | Description |
|---|---|---|
token |
Token |
Auth token passed as an HTTP header. |
workflow_identifier |
Text |
Identifier of the workflow to update. |
Optional arguments
Each argument accepts the same values as in workflows.create. Except where noted below, sending null leaves the value unchanged.
| Name | Type | Description |
|---|---|---|
identifier |
Text |
New identifier for the workflow. May only contain letters, numbers, underscores, periods, and hyphens. |
name |
Text |
Display name of the workflow. |
description |
Text |
Description of the workflow. Send null to clear it. |
icon |
Text |
Icon for the workflow. Send null to clear it. |
color |
Text |
Color for the workflow, as a hex value (for example #38bdf8). |
scope |
Text |
GLOBAL or ENTITY. Cannot be null; leave it out to keep the current scope. |
execution_type |
Text |
SIMPLE or EVENT_DRIVEN. |
timeout |
Text |
How long an EVENT_DRIVEN workflow run can wait for a completion event before it times out: ONE_HOUR, SIX_HOURS, TWELVE_HOURS, ONE_DAY, THREE_DAYS, SEVEN_DAYS, FOURTEEN_DAYS, or THIRTY_DAYS. Send null to reset it to the default of one hour. |
trigger_type |
Text |
Who can trigger the workflow: ANY, APPROVAL, RUNNERS, or ENTITY. See Approvers and runners. |
entity_filter_type |
Text |
ENTITY_TYPES or SQL. Switching to SQL clears entity_filter_type_identifiers, and switching to ENTITY_TYPES clears entity_filter_sql. |
entity_filter_type_identifiers |
Array<Text> |
Identifiers of the entity types the workflow applies to. |
entity_filter_sql |
Text |
SQL that selects the entities the workflow applies to. |
http_request |
Object |
The HTTP request sent when the workflow runs. Replaces the whole request. See http_request. |
parameters |
Array<Object> |
The full list of parameters. See Parameters. |
approver_user_ids |
Array<Text> |
The full list of IDs of active users who approve runs. See Approvers and runners. |
runners |
Array<Object> |
The full list of users or teams allowed to run the workflow. Each item has one of user_id, squad_id, or squad_linkage_id, and must belong to your account. See Approvers and runners. |
Parameters
When you send parameters, it replaces the workflow’s whole list. Parameters are matched by identifier: matching ones are updated, new ones are added, and any parameter missing from the list is removed. Leave parameters out to keep the current list. Each item uses the same fields as Workflow parameters in workflows.create.
Adding or changing the SQL of a COMPUTED parameter with a personal access token requires the issuing user to have Data Studio access. Sending a COMPUTED parameter with its current SQL unchanged does not.
Approvers and runners
approver_user_ids and runners each replace the whole list when sent.
- Changing
trigger_typetoAPPROVALrequiresapprover_user_ids, and changing it toRUNNERSrequiresrunners. - Changing
trigger_typeaway fromAPPROVALorRUNNERSremoves the workflow’s approvers or runners. - Leaving out
approver_user_idsorrunners, without changingtrigger_type, keeps the current list. - Sending
nullfor either list counts as an empty list, which is rejected whiletrigger_typeisAPPROVALorRUNNERS.
Example request
This request renames a workflow and changes it to require approval, leaving everything else unchanged:
curl -X POST https://api.getdx.com/workflows.update \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer xxxx-xxxxxxxxx-xxxx' \
--data '{
"workflow_identifier": "provision-single-tenant-instance",
"name": "Provision Single-tenant Instance (approval required)",
"trigger_type": "APPROVAL",
"approver_user_ids": ["123"]
}'
Example response
This is a typical success response. It returns the workflow with all of its current values.
{
"ok": true,
"workflow": {
"identifier": "provision-single-tenant-instance",
"name": "Provision Single-tenant Instance (approval required)",
"description": "Create a new single-tenant instance and associate with an account",
"icon": "globe",
"color": "#38bdf8",
"scope": "ENTITY",
"entity_filter_type": "ENTITY_TYPES",
"entity_filter_sql": null,
"entity_filter_type_identifiers": ["service"],
"execution_type": "EVENT_DRIVEN",
"timeout": "ONE_DAY",
"trigger_type": "APPROVAL",
"approvers": [
{
"id": 123,
"name": "Jane Doe"
}
],
"runners": [],
"parameters": [
{
"identifier": "app_name",
"name": "App name",
"description": "The all-lowercase name of the app to provision.",
"default_value": null,
"is_required": true,
"type": "STRING",
"definition": null
}
]
}
}
For a workflow with trigger_type of RUNNERS, each item in runners is either a user or a team:
"runners": [
{
"user_id": 123,
"user": { "id": 123, "name": "Jane Doe" }
},
{
"squad_id": 456,
"squad_linkage_id": "a1b2c3",
"squad": { "id": 456, "name": "Platform" }
}
]
Errors
This table lists the expected errors that this method could return. However, other errors can be returned in the case where the service is down or other unexpected factors affect processing. Callers should always check the value of the ok param in the response.
| Error | Description |
|---|---|
not_authed |
No authentication token provided. |
invalid_auth |
Some aspect of authentication cannot be validated. |
not_authorized |
The token lacks the workflows:manage scope, or the personal access token’s user is not a Self-Service Admin. |
missing_content_type |
A request body was sent without a Content-Type header. |
invalid_json |
The request body is not valid JSON. |
Missing required parameter: <name> |
workflow_identifier was not provided. |
workflow_not_found |
No workflow with this workflow_identifier exists in your account. Returned with HTTP status 404. |
invalid_timeout |
timeout is not one of the allowed values. error_details.message lists them. Returned with HTTP status 422. |
Invalid parameter: <message> |
The updated workflow failed validation, for example a duplicate or malformed identifier, an invalid scope, or a malformed http_request. The message describes each problem. |
workflow_parameter_validation_failed |
A parameter is invalid. error_details.parameter_index is the zero-based index of the offending parameter and error_details.errors describes the problems. |
workflow_approver_validation_failed |
approver_user_ids is empty or contains users that are not active users in your account when trigger_type is APPROVAL. |
workflow_runner_validation_failed |
runners is empty when trigger_type is RUNNERS, or a runner is invalid or does not belong to your account. |
invalid_variables_in_http_request |
The http_request references variables that are not available. error_details.errors lists the offending fields. |