Invoke operator API service

Call the published and enabled operator API service. The fields of payload must conform to the input definition of the service; first View Service Configuration confirms that the service can be called and obtains the input definition.

HTTP
POST $CLOUDSIGMA_API_BASE/workflow/v2/workitems/catalog/$NODE_ID/api-service/invoke

Before you call this API

Configure the regional API endpoint and authentication, and select the target workspace.

First View Service Configuration, confirm that the service is enabled, and obtain the operator ID, version and service name of the service to be called.

Request

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\",
    \"type\": \"operator\",
    \"version\": \"$VERSION\",
    \"payload\": {
      \"sql\": \"SELECT now()\"
    }
  }"

Request body

ParameterTypeRequiredDescription
node_idstringRequiredThe ID of the operator to be called.
service_namestringRequiredService name, using data.service.service_name from the service configuration response.
typestringRequiredFixed to operator.
versionstringRequiredThe published operator version.
payloadobjectthe input data of the service; fields and types are subject to data.service.input_schema.

Successful response

data.result returns the status and operator output of this call. result is returned as a JSON format string; the operator output is read after parsing the string. When error appears in the response, handle it as an error message.

The response fields are as follows.

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "result": {
      "case_id": "case_01JEX4A1M2",
      "status": "COMPLETED",
      "result": "{\"count\":9}"
    }
  }
}
FieldTypeDescription
codestringOK on success.
msgstringOK on success.
data.result.case_idstringID of this call; can be used to correlate this result when the response is provided.
data.result.statusstringThe status returned by the service; occurs when the response is provided.
data.result.resultstringJSON format string returned by the service; the parsed structure is determined by the operator.
data.result.errorstringError message returned by the service; appears when there is an error.

Error response

JSON
{
  "code": "api_service_unavailable",
  "msg": "服务暂不可用",
  "data": null
}
FieldTypeDescription
codestringError code.
msgstringReadable error message.
datanull`null` in an error response.

Follow-up operations

After the call is completed, when you need to check the configuration View operator API service configuration.

Last updated on