Overview
The names, target parameters, step configurations, and remarks of all tasks are updated. The sopType parameter in the request does not change the task type; the server always retains the original task type.
API details
Constraints
You must have the SOP_TASK:UPDATE permission on this task and the UPDATE permission on the target resource. The task must not have been started.
Request path
PUT /api/v2/sop/tasks/{id}
Request parameters
Parameter |
Location |
Type |
Required |
Description |
|---|---|---|---|---|
| id | Path | Long | Yes | The ID of the task to be edited. |
| name | Body | String | Yes | The same as the username creation rule: globally unique, 2–32 characters in length, and must comply with the same character rules. |
| sopType | Body | String | No | You can pass the original task type to maintain request readability. The valid values are onlyREBUILD_STANDBY_TENANT、ARBITRATION_FOR_FAULTY_REPLICA、OBSERVER_DATA_REBUILD, but it is not used to modify the task type. |
| targetParam | Body | Object | Yes | Similar to the creation API, the fields and constraints provided are based on the original task's SOP type. |
| steps | Body | Array | Yes | Same as the creation API. Steps cannot be empty, template steps cannot be repeated, and fixed enable steps must be provided. |
| steps[].stepIndex | Body | Integer | No | Target step number. If not provided, the default value from the template is used. The numbers must be consecutive and unique. Only steps that can be moved are eligible for reordering. |
| steps[].stepKey | Body | String | Yes | Step identifiers in the original task type template must be unique. |
| steps[].autoRun | Body | Boolean | No | Automatic execution switch. If not specified, the default value of the template is retained. Do not modify the default value for steps that cannot be edited. |
| steps[].enabled | Body | Boolean | No | Whether to enable the step; only steps that can be disabled in the template can be set tofalse. |
| comments | Body | String | No | Updated remarks. |
| startNow | Body | Boolean | No | trueImmediately start after the update; if not specified/falseNot started. |
The allowed values for steps[].stepKey during editing are also determined by the original task type:
sopType |
steps[].stepKeyValid values |
|---|---|
REBUILD_STANDBY_TENANT |
CONFIRM_STANDBY_TENANT_INFO、BACKUP_PRIMARY_TENANT、DISCONNECT_STANDBY_TENANT、LOCK_STANDBY_TENANT、DELETE_STANDBY_TENANT、CREATE_STANDBY_TENANT、VERIFY_PRIMARY_STANDBY_SYNC |
ARBITRATION_FOR_FAULTY_REPLICA |
CONFIRM_ARBITRATION_TARGET、ADD_ARBITRATION_SERVICE、DELETE_TENANT_REPLICA、DELETE_OBSERVER、ENABLE_TENANT_ARBITRATION、VERIFY_TENANT_ARBITRATION |
OBSERVER_DATA_REBUILD |
CONFIRM_OBSERVER_TARGET、DELETE_TENANT_REPLICA、DELETE_OBSERVER、FORCE_DELETE_HOST、ADD_OBSERVER、ADD_TENANT_REPLICA、VERIFY_REPLICA_REBUILD |
Response parameters
Parameter |
Type |
Description |
|
|---|---|---|---|
| successful | Boolean | Returns 0 on success.true. |
|
| data.id | Long | Task ID. | |
| data.name | String | The updated task name. | |
| data.sopType | String | Original task SOP type code. | |
| data.sopTypeDisplayName | String | The display name of the SOP type in the current locale. | |
| data.targetParam | Object | Saved task-level target parameters and server-side parsed/complementary fields. Rebuilding standby tenants includesstandbyClusterId、standbyTenantId、logTransportMode; The arbitration types includeclusterIdChoose either arbitration service or service group; OBServer rebuild includesclusterIdand optionalreplacementHostId. |
|
| data.operationObjects | Object | Displays the parsed objects. Rebuilding a standby tenant may include the original/new standby tenant, original/new standby cluster, primary tenant, primary cluster, various IDs, log transfer methods, and backup configurations; arbitration type may include the affected tenant, faulty IP, arbitration service/service group, and service connection information; OBServer rebuilding may include the affected tenant, faulty IP, Zone, and alternate host ID/IP. If a field does not exist, it is not returned. | |
| data.targetSummary.displayText | String | Summary text for the target. | |
| data.targetSummary.kind | String | Target category. | |
| data.targetSummary.details[] | Array | Summary details; each item includeslabel(name) andvalue(value). |
|
| data.steps[] | Array | The steps after saving; each item containsstepIndex、stepKey、stepName、stepKind、stepDescription、autoRun、enabled、blockNext、editable、userMovable、minStepIndex、maxStepIndex. |
|
| data.comments | String \ | null | Updated remarks. |
| data.creator | String | Username of the creator. | |
| data.createTime | Datetime | The time when the task was created. | |
| data.updateTime | Datetime | Last update time of the task. | |
| data.displayStatus | String | Updated status. If not started, it isNOT_STARTED, which indicates the actual execution status when you start it immediately. |
|
| data.currentExecutionId | Long \ | null | Instance ID; 0 if not startednull. |
| 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
In addition to the SOP10001–SOP10007 response parameters for creating an interface, the following response parameters may also be returned:
HTTP |
Error Code |
Description |
|---|---|---|
| 404 | SOP10008 |
The task does not exist. |
| 400 | SOP10009 (SOP_TASK_ALREADY_STARTED) |
The task already has an execution instance and cannot be edited. |
