Invoke operator API service

Execute the published and enabled operator service and wait for the results to be returned from this run. After the call is completed, check the running status and error information before reading the output.

HTTP
POST $CLOUDSIGMA_API_BASE/workflow/v2/workitems/catalog/{node_id}/api-service/invoke

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 operator API service configuration, select the callable service, and confirm the operator version, service name and input definition. Prepare a personal access token and target workspace ID that can access the target workspace.

Select a custom operator enabled in the current workspace. The same operator name must be uniquely located in the workspace. System operators, disabled operators, or operators with the same name cannot be operated through this interface.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/workflow/v2/workitems/catalog/$NODE_ID/api-service/invoke" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  -d '{
  "service_name": "'"$SERVICE_NAME"'",
  "version": "'"$VERSION"'",
  "payload": {
    "text": "CloudSigma!"
  }
}'

The following example uses the text counting operator as an example. $CLOUDSIGMA_API_KEY is the personal access token, and $WORKSPACE_ID is the target workspace ID. See the parameter list for the remaining variables. Replace payload with the input definition of the actual service.

Parameter

Type

Required

Description

node_id

string

Yes

operator ID. Fill in the data.service.node_id returned by the service configuration into $NODE_ID.

Request body

Field

Type

Required

Description

service_name

string

Yes

Service name. Fill in the data.service.service_name returned by the service configuration into $SERVICE_NAME.

version

string

Yes

Published operator version. Fill in data.service.version into $VERSION, which must match the operator in the path.

payload

object

Yes

operator input. Fields and types must meet the data.service.input_schema definition.

type

string

No

Call type identifier.

The input definition in the configuration is a JSON string that is parsed to construct the input by its required fields and types.

operator is used when type is omitted or empty, other non-null values are not accepted. The payload cannot contain the reserved key __notification_config. Place the business input in payload and fill it in according to the input Schema of the service.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "result": {
      "case_id": "case-example",
      "status": "COMPLETED",
      "result": {
        "count": 11
      }
    }
  }
}

Determine the running results

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "result": {
      "case_id": "case-example",
      "status": "FAILED",
      "error": "Operator execution failed"
    }
  }
}

Field

Type

Description

code

string

When the interface request is successful, it is OK, which does not mean that the operator runs successfully.

msg

string

Human-readable information requested by the interface.

data

object

response data.

data.result

object

The result of this call.

data.result.case_id

string

This run ID.

data.result.status

string

Running status. How completion and failure are handled is described below.

data.result.result

JSON value

The raw JSON value output by the operator. Returned when successful and output is available.

data.result.error

string

Run error message. Returned if there is an error.

Error response

When the request fails parameter verification or the service is disabled, the interface returns an unsuccessful HTTP status. If the operation fails, HTTP 200 may still be returned, and should be handled according to the above operation result rules.

JSON
{
  "code": "ErrParamInvalid",
  "msg": "Invalid request parameters"
}

Common HTTP errors

HTTP status

Error code

Common cause

Recommended action

400

ErrParamInvalid

Input is missing required fields or does not match the input schema.

Update the request to match the configured service input schema.

409

api_service_disabled

The operator API service is disabled.

Enable the operator API service before calling it again.

HTTP 429 is returned when the call rate limit of the current service is exceeded. Wait timeouts or post-commit errors do not prove that the operator was not executed. Check the actual running status first, and then decide whether to resubmit.

Last updated on