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.
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¶
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 |
|---|---|---|---|
|
string |
Yes |
operator ID. Fill in the |
Request body
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Service name. Fill in the |
|
string |
Yes |
Published operator version. Fill in |
|
object |
Yes |
operator input. Fields and types must meet the |
|
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¶
{
"code": "OK",
"msg": "OK",
"data": {
"result": {
"case_id": "case-example",
"status": "COMPLETED",
"result": {
"count": 11
}
}
}
}
Determine the running results¶
{
"code": "OK",
"msg": "OK",
"data": {
"result": {
"case_id": "case-example",
"status": "FAILED",
"error": "Operator execution failed"
}
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
When the interface request is successful, it is |
|
string |
Human-readable information requested by the interface. |
|
object |
response data. |
|
object |
The result of this call. |
|
string |
This run ID. |
|
string |
Running status. How completion and failure are handled is described below. |
|
JSON value |
The raw JSON value output by the operator. Returned when successful and output is available. |
|
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.
{
"code": "ErrParamInvalid",
"msg": "Invalid request parameters"
}
Common HTTP errors¶
HTTP status |
Error code |
Common cause |
Recommended action |
|---|---|---|---|
400 |
|
Input is missing required fields or does not match the input schema. |
Update the request to match the configured service input schema. |
409 |
|
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.