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 $CLOUDSIGMA_API_BASE/workflow/v2/custom-operators/$OPERATOR_ID
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. First query the custom operator list, select an operator and obtain the custom operator ID. Then Query custom operator details to confirm the configuration to be modified. Prepare personal access token and target workspace ID that can access the target workspace.
The operator type, version, or enabled status cannot be modified through this interface. To change the type or version, create a new custom operator. To change the enabled status, use Enable custom operator or Disable custom operator.
Request body¶
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": "统计输入文本的字符数,并返回结果。",
"code": "def handle(workspace_id, sdk, input):\n return {\"count\": len(input[\"text\"])}"
}'
Code text and source file ID cannot be submitted at the same time. Type-specific fields are only used for the corresponding type. When you replace a source file, references to the new file are increased and references to the old file are decreased. When uploading code fails, the service attempts to undo the operation, but external file operations may not be fully undone.
Keep the original value when omitting a field or filling in null. Description: Clear when filling in a blank string. The name cannot be an empty string. The ID of the associated directory and database is cleared when 0 is filled in. Negative numbers cannot be filled in. Even if no fields are modified, the modification time and modifier will be updated.
All fields are optional. Submit only the fields you want to modify.
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string or null |
No |
operator name. |
|
string or null |
No |
operator description. |
|
string or null |
No |
Resource type. |
|
string or null |
No |
operator implementation language. |
|
string or null |
No |
operator processing function. |
|
string or null |
No |
The current resource version. |
|
string or null |
No |
operator isolation configuration. |
|
string or null |
No |
source code. |
|
string or null |
No |
Source file ID. |
|
string or null |
No |
Base operator ID. |
|
string or null |
No |
Base operator version. |
|
object or string or null |
No |
Enter the definition. |
|
object or string or null |
No |
Output definition. |
|
object or string or null |
No |
Binding configuration. |
|
integer or null |
No |
Associate Catalog ID. Non-positive values are ignored when created. 0 clears the association when updating, and negative numbers are invalid. |
|
integer or null |
No |
Associated database ID. Non-positive values are ignored when created. 0 clears the association when updating, and negative numbers are invalid. |
|
null |
No |
Whether to enable. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"id": 123,
"node_id": "moi:custom.operator:workspace:text_counter",
"name": "文本计数",
"identifier": "text_counter",
"description": "统计输入文本的字符数,并返回结果。",
"language": 1,
"handler": "main.handle",
"isolation_level": "PUBLIC",
"input_schema": "{\"type\":\"object\"}",
"output_schema": "{\"type\":\"object\"}",
"enabled": true,
"kind": 1,
"catalog_id": 1,
"database_id": 2
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
success code. |
|
string |
Response information. |
|
object |
The data returned by this operation. |
|
integer |
Custom operator ID. |
|
string |
The operator ID in the workflow. |
|
string |
The updated operator name. |
|
string |
operator identification. |
|
string |
Updated instructions. |
|
integer |
operator implements language code. |
|
string |
Code type handler function. |
|
string |
operator version. |
|
string |
operator isolation configuration. |
|
string |
Source file ID. |
|
string |
Enter the defined serialization content. |
|
string |
Outputs the serialized content of the definition. |
|
boolean |
Current enabled status. |
|
string |
Creator ID. |
|
string |
Last updated by identifier. |
|
integer |
Unix timestamp of creation time. |
|
integer |
Unix timestamp of last updated time. |
|
integer |
operator type code. |
|
string |
Association ID. |
|
string |
Base node version. |
|
string |
Extended configuration. |
|
integer |
The associated Catalog ID. |
|
integer |
The associated database ID. |
Error response¶
{
"code": "ErrParamInvalid",
"msg": "请求参数无效"
}
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
No |
error code. |
|
string |
No |
Readable error message. |
Common HTTP errors¶
HTTP status |
Error code |
Common cause |
Recommended action |
|---|---|---|---|
400 |
|
Invalid request field, workspace, or operation precondition. |
Fix the request parameters and submit again. |
403 |
|
The current identity or active role does not have permission for this operation. |
Use an authorized identity or contact an administrator to grant access. |
404 |
|
The target object or required reference was not found. |
Verify the object identifier, workspace, and current status. |
409 |
|
Conflict in resource state, request payload, or concurrent modification. |
Re-read the current state and version, then handle according to the latest result. |
500 |
|
Internal processing failed; write operations may have been partially applied. |
Retain request and trace details, and verify the current state before retrying. |
503 |
|
A business, runtime, or authorization dependency is temporarily unavailable. |
After the dependency recovers, check existing results first instead of blindly repeating writes. |