Cancel workflow job¶
Requests cancellation of a specified workflow job. HTTP success does not mean that the job has been terminated; please read the return status or query the job details to confirm the final status.
HTTP
POST $CLOUDSIGMA_API_BASE/workflow/v2/workflow-apps/{workflow_id}/executions/{execution_id}/cancel
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
First query job details and check whether available_actions contains cancellation.
The request body cannot contain runtime_context.
Request¶
Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workflow/v2/workflow-apps/$WORKFLOW_ID/executions/$EXECUTION_ID/cancel" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"reason": "<REASON>"
}'
Request body
| Parameter | Type | Required | Description |
|---|---|---|---|
workflow_id | string | Required | Workflow ID. |
execution_id | string | Required | Job ID. |
reason | string | Compatible field; currently does not affect cancellation processing. |
Successful response¶
Returns 200 when the service accepts the cancellation request and returns the job details at that time. The returned status can still be the current running status; query the job details to confirm the final cancellation status.
JSON
{
"code": "OK",
"msg": "OK",
"data": {
"execution": {
"execution_id": "exec-001",
"workflow_id": "wf-001",
"status": "running",
"available_actions": [],
"execution_mode": "one_shot",
"input_payload": {},
"vars_payload": {}
}
}
}
| Field | Type | Description |
|---|---|---|
code | string | `OK` when successful. |
msg | string | `OK` when successful. |
data.execution.execution_id | string | Execution ID. |
data.execution.workflow_id | string | Workflow ID. |
data.execution.status | string | Execution status when the cancellation request is accepted; this response alone does not confirm final cancellation. |
data.execution.available_actions | string[] | Currently allowed operations. |
data.execution.execution_mode | string | Execution mode. |
data.execution.cron_expression | string | Cron expression; only returned in timing mode. |
data.execution.input_payload | object | Expanded run input. |
data.execution.vars_payload | object | Expanded run variable. |
data.execution.moi_task_id | string | Task ID; returned when the server has assigned it. |
data.execution.moi_case_id | string | Case ID; returned when the server has assigned it. |
data.execution.moi_workflow_def_id | string | Workflow definition identifier; returned when the server has assigned it. |
data.execution.moi_workflow_version_id | string | Workflow version identifier; returned when the server has assigned it. |
data.execution.pause_scope | string | Pause range; returned when there is a value. |
data.execution.error | string | Error message; returned if there is a value. |
data.execution.started_at | string | Start time; may be omitted if not generated. |
data.execution.ended_at | string | End time; may be omitted if not generated. |
data.execution.created_at | string | Creation time; returned when provided by the server. |
data.execution.updated_at | string | Last update time; returned when provided by the server. |
Error response¶
JSON
{
"code": "ErrParamInvalid",
"msg": "请求参数无效",
"data": null
}
| Field | Type | Description |
|---|---|---|
code | string | Error code. |
msg | string | Readable error message. |
data | null | `null` in an error response. |
Follow-up operations¶
Use the same job ID query workflow job details to confirm the final status.
Last updated on