Overview
Creates a unique execution instance and all enabled steps, and starts the first step. When the first step is executed automatically, the return status depends on the immediate processing result; when the first step requires manual execution, it returns WAITING_CONFIRM.
API details
Constraints
You must have the SOP_TASK:UPDATE permission on this task and the UPDATE permission on the target resource. A task can only be started once.
Request path
POST /api/v2/sop/tasks/{id}/start
Request parameters
Parameter |
Location |
Type |
Required |
Description |
|---|---|---|---|---|
| id | Path | Long | Yes | Task ID. |
Response parameters
Parameter |
Type |
Description |
|
|---|---|---|---|
| successful | Boolean | Returns 0 on success.true. |
|
| data.id | Long | The ID of the newly created execution instance. | |
| data.sopTaskId | Long | The task ID. | |
| data.status | String | Execution Status:WAITING_CONFIRM、RUNNING、FAILEDorCOMPLETED. |
|
| data.displayStatus | String | Display status; current anddata.statusThe same. |
|
| data.currentStepIndex | Integer | The serial number of the earliest unsuccessful step. If all steps are successful, the serial number of the last step is retained. | |
| data.totalSteps | Integer | Total number of steps to enable. | |
| data.readyManualStepIndexes | Array<Integer> | Currently ready for manual advancement andautoRun=falseThe step number. |
|
| data.executor | String | Username for starting the execution. | |
| data.startTime | Datetime | Execution start time. | |
| data.finishTime | Datetime \ | null | End or failure time of the execution. If not ended, it isnull. |
| 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. |
|
| 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. | |
| data.steps[].errorMessage | String \ | null | Information about the most recent failures, with a maximum retention of 1024 characters. |
| 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. |
| 400 | SOP10009 |
The task has been started. Only one request succeeds when starting concurrently. |
| 400 | SOP10002and scenario error codes |
Revalidation of the target object, topology, or runtime status failed. |
