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.

PUT https://moi.matrixorigin.cn/newmoi/workflow/v2/custom-operators/$OPERATOR_ID

Preparation before calling

First query custom operator details to confirm the operator to be modified. Prepare the personal access token, target workspace ID, and custom operator ID that have access to the target workspace.

Do not pass enabled in the request body; instead use Enable custom operator or Disable custom operator.

Request body

All fields are optional; submit only the fields you want to modify.

descriptionstring
Operator description.
codestring
Source code.
namestring
Operator name.
kindstring
Operator type.
languagestring
Operator implementation language.
handlerstring
Operator handler.
versionstring
Operator version.
isolation_levelstring
Operator isolation configuration.
input_schemaobject
Input definition.
output_schemaobject
Output definition.
source_file_idstring
Source file ID.
base_node_idstring
Base operator ID.
base_node_versionstring
Base operator version.
binding_configobject
Binding configuration.
catalog_idinteger
Associated catalog ID.
database_idinteger
Associated database ID.

Request example

curl -X PUT "https://moi.matrixorigin.cn/newmoi/workflow/v2/custom-operators/$OPERATOR_ID" \
  -H "X-API-Key: $AI_STUDIO_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\"])}"
  }'

Successful response

The response returns the updated operator configuration.

The response fields are as follows.

codestring
OK on success.
msgstring
OK on success.
data.idinteger
Custom operator ID.
data.node_idstring
Operator ID in the workflow.
data.namestring
Operator name.
data.identifierstring
Operator ID.
data.descriptionstring
Updated operator description; returned if there is a value.
data.handlerstring
Updated processing function; returned when there is a value.
data.versionstring
The updated operator version; returned if there is a value.
data.isolation_levelstring
The updated isolation configuration; returned if there is a value.
data.languageinteger
Implements the numerical encoding of the language; returns if there is a value.
data.kindinteger
Numeric encoding of the operator type; returned if there is a value.
data.source_file_idstring
Source file ID; returned when created using a source file.
data.input_schemastring
Enter the defined serialization content; return if there is a value.
data.output_schemastring
Output the defined serialized content; return if there is a value.
data.binding_configstring
The serialized content of the binding configuration; returned if there is a value.
data.created_bystring
Creator ID; returned if there is a value.
data.updated_bystring
Last updater ID; returned if there is a value.
data.created_atinteger
Creation timestamp; returned if there is a value.
data.updated_atinteger
Last updated timestamp; returned if there is a value.
data.base_node_idstring
The basic operator associated with the built-in binding type; returned when there is a value.
data.base_node_versionstring
The basic operator version associated with the built-in binding type; returned when there is a value.
data.catalog_idinteger
The associated Catalog ID; returned if there is a value.
data.database_idinteger
The associated database ID; returned if there is a value.
data.enabledboolean
Whether the operator is enabled.

Successful response example

{
  "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
  }
}

Error response

codestring
Error code.
msgstring
Readable error message.
datanull
`null` in an error response.

Error response example

{
  "code": "ErrParamInvalid",
  "msg": "请求参数无效",
  "data": null
}

Follow-up operations

Use the same resource identifier query custom operator details to confirm the update result.

Last updated on