Update custom operator¶
Modify the configuration or code of a custom operator. The enabled status cannot be modified through this interface, please use dedicated enable or disable operations.
HTTP
PUT $CLOUDSIGMA_API_BASE/workflow/v2/custom-operators/$OPERATOR_ID
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
First query custom operator details to confirm the operator to be modified.
Do not pass enabled in the request body; instead use Enable custom operator or Disable custom operator.
Request¶
All fields are optional; submit only the fields you want to modify.
Shell
curl -X PUT "$CLOUDSIGMA_API_BASE/workflow/v2/custom-operators/$OPERATOR_ID" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"description": "Counts characters in the input text and returns results.",
"code": "def handle(workspace_id, sdk, input):\n return {\"count\": len(input[\"text\"])}"
}'
Request body
| Field | Type | Description |
|---|---|---|
description | string | Operator description. |
code | string | Source code. |
name | string | Operator name. |
kind | string | Operator type. |
language | string | Operator implementation language. |
handler | string | Operator handler. |
version | string | Operator version. |
isolation_level | string | Operator isolation configuration. |
input_schema | object | Input definition. |
output_schema | object | Output definition. |
source_file_id | string | Source file ID. |
base_node_id | string | Base operator ID. |
base_node_version | string | Base operator version. |
binding_config | object | Binding configuration. |
catalog_id | integer | Associated catalog ID. |
database_id | integer | Associated database ID. |
Successful response¶
The response returns the updated operator configuration.
The response fields are as follows.
JSON
{
"code": "OK",
"msg": "OK",
"data": {
"id": 123,
"node_id": "moi:custom.operator:workspace:text_counter",
"name": "Text Counter",
"identifier": "text_counter",
"description": "Counts characters in the input text and returns results.",
"language": 1,
"kind": 1,
"handler": "main.handle",
"version": "1.0.0",
"input_schema": "{\"type\":\"object\"}",
"output_schema": "{\"type\":\"object\"}",
"isolation_level": "PUBLIC",
"catalog_id": 1,
"database_id": 2,
"enabled": true
}
}
| Field | Type | Description |
|---|---|---|
code | string | OK on success. |
msg | string | OK on success. |
data.id | integer | Custom operator ID. |
data.node_id | string | Operator ID in the workflow. |
data.name | string | Operator name. |
data.identifier | string | Operator ID. |
data.description | string | Updated operator description; returned if there is a value. |
data.handler | string | Updated processing function; returned when there is a value. |
data.version | string | The updated operator version; returned if there is a value. |
data.isolation_level | string | The updated isolation configuration; returned if there is a value. |
data.language | integer | Implements the numerical encoding of the language; returns if there is a value. |
data.kind | integer | Numeric encoding of the operator type; returned if there is a value. |
data.source_file_id | string | Source file ID; returned when created using a source file. |
data.input_schema | string | Enter the defined serialization content; return if there is a value. |
data.output_schema | string | Output the defined serialized content; return if there is a value. |
data.binding_config | string | The serialized content of the binding configuration; returned if there is a value. |
data.created_by | string | Creator ID; returned if there is a value. |
data.updated_by | string | Last updater ID; returned if there is a value. |
data.created_at | integer | Creation timestamp; returned if there is a value. |
data.updated_at | integer | Last updated timestamp; returned if there is a value. |
data.base_node_id | string | The basic operator associated with the built-in binding type; returned when there is a value. |
data.base_node_version | string | The basic operator version associated with the built-in binding type; returned when there is a value. |
data.catalog_id | integer | The associated Catalog ID; returned if there is a value. |
data.database_id | integer | The associated database ID; returned if there is a value. |
data.enabled | boolean | Whether the operator is enabled. |
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 resource identifier query custom operator details to confirm the update result.
Last updated on