View custom operator code

Read the source code of a custom operator. Source code may contain business logic or connection information, please save it according to your team’s code and key management requirements.

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

Preparation before calling

First query the custom operator list to confirm the operator to read the code. Prepare the personal access token, target workspace ID, and custom operator ID that have access to the target workspace.

Request parameters

Request example

curl "https://moi.matrixorigin.cn/newmoi/workflow/v2/custom-operators/$OPERATOR_ID/code" \
  -H "X-API-Key: $AI_STUDIO_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID"

Successful response

The response returns the source code of the operator.

The response fields are as follows.

codestring
OK on success.
msgstring
OK on success.
data.sourcestring
Source code of custom operator.

Successful response example

{
  "code": "OK",
  "msg": "OK",
  "data": {
    "source": "def handle(workspace_id, sdk, input):\\n    return input"
  }
}

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

When modification is needed, Update custom operator. When returning the list query custom operator list.

Last updated on