Features
Query the execution status of a task and the status of all its steps. If a task has not been started, the preview is still successfully returned: the execution ID, current step, executor, and time are null, the status is NOT_STARTED, and all steps are PENDING.
API details
Constraints
You must have the SOP_TASK:READ permission for this task.
Request path
GET /api/v2/sop/tasks/{taskId}/execution
Request parameters
Parameter |
Location |
Type |
Required |
Description |
|---|---|---|---|---|
| taskId | Path | Long | Yes | Task ID. |
Response parameters
Parameter |
Type |
Description |
|
|---|---|---|---|
| successful | Boolean | Returns 0 on success.true. |
|
| data.id | Long \ | null | Instance ID; when the instance is not startednull. |
| data.sopTaskId | Long | The task ID. | |
| data.status | String | Execution Status:NOT_STARTED、WAITING_CONFIRM、RUNNING、FAILEDorCOMPLETED. |
|
| data.displayStatus | String | Displays the status. The current value isdata.statusThe same. |
|
| data.currentStepIndex | Integer \ | null | The earliest step number that has not been successfully executed. If preview is not started, it isnull. |
| data.totalSteps | Integer | Total number of steps to execute or preview. | |
| data.readyManualStepIndexes | Array<Integer> | The serial number of the current manually actionable step. It is an empty array when no step is started. | |
| data.executor | String \ | null | Username for starting the execution; left unspecified when not starting.null. |
| data.startTime | Datetime \ | null | Execution start time; for tasks not started yet.null. |
| data.finishTime | Datetime \ | null | End or failure time of the execution. If not ended, it isnull. |
| data.context | Object \ | null | The current response assembly logic typically does not assign values, and callers should not rely on its content. |
| data.steps[] | Array | Information on the execution of all steps. | |
| data.steps[].stepIndex | Integer | Step number. | |
| data.steps[].stepKey | String | Unique identifier of the step. | |
| data.steps[].stepName | String | Step display name. | |
| data.steps[].status | String | PENDING、RUNNING、SUCCESSFULorFAILED; When preview is not started, it isPENDING. |
|
| data.steps[].autoRun | Boolean | Current auto-execution switch. | |
| data.steps[].stepParam | Object \ | null | Step parameters have been saved. If not set, the value isnull. |
| data.steps[].taskInstanceIds | Array<Long> | Associated OCP task instance ID; an empty array if not available. | |
| data.steps[].retryCount | Integer | Number of retries. If preview is not started, the value is0. |
|
| data.steps[].errorMessage | String \ | null | Step failure information. |
| data.steps[].startTime | Datetime \ | null | Step start time. |
| data.steps[].finishTime | Datetime \ | null | Step end time. |
| timestamp | Datetime | The time taken by the server to create the response. | |
| duration | Long | The time consumed by the server for processing, in milliseconds. | |
| status | Integer | HTTP status code. In case of success, it is200. |
|
| traceId | String | Request link ID, used for log troubleshooting. |
Error codes
HTTP |
Error Code |
Description |
|---|---|---|
| 404 | SOP10008 |
The task does not exist. |
