Skip to main content

API Documentation

Key APIs

Create Workflow

  • URL: /flow/bg/manage/descriptor/add_descriptor.json
  • Method: POST
  • Request Parameter Description
Parameter NameRequiredTypeDescription
business_idYesStringWorkflow business ID
feature_nameYesStringWorkflow service name
aliasYesStringWorkflow alias
  • Request Body parameters:Workflow yaml Definition

  • Request Example

curl --location --request POST ' http:///127.0.0.1:8080/flow/bg/manage/descriptor/add_descriptor. son?business_id=demoFlowTest &feature_name=demoFlowTest &alias=release' \
--header 'Content-Type: text/plain' \
--data-raw -
version: 20230829
workspace: demoFlowTest
dagName: DemoTest
type:
tasks:
- category: function
name: startNode
next: endNode
resourceName: http://127. .0.1:8080/flow/sample/start_node. son
pattern: task_sync
inputMappings:
- target: $. nput.right
source: $context.right
- target: $input. eft
source: $.context. eft
outputMappings:
- target: $. ontext.result_number
source: $.output. esult_number
- category: function
name: endNode
resourceName: http://127. .0.1:8080/flow/sample/end_node.json
pattern: task_sync
inputMappings:
- target: $input. esult_number
source: $.context.result_number
- target: $. nput.expect_number
source: $.context.result_number
  • Response:
{
"ret": true, // true: Success, false: Failure
"descriptor_id": "" // Workflow ID
}

Execute Workflow

  • URL: /flow/submit.json
  • Method: POST
  • Request Parameter Description
Parameter NameRequiredTypeDescription
descriptor_idYesStringWorkflow ID
callbackNoStringCallback URL upon completion
resource_checkNoStringResource check rule
  • Background information to request the Body parameter:workflow

  • Request Example

curl -XPOST 'http://127.0.0.1:8080/2/flow/submit.json?descriptor_id=demoFlowTest:demoTest' -d '{"left": 512, "right": 512}' -H'Content-Type:application/json'
  • Response:
{
"execution_id": "" // Execution ID
}

Task Completion Callback

  • URL: /flow/finish.json
  • Method: POST
  • Request Parameter Description
Parameter NameRequiredTypeDescription
Execution IdYesStringExecution ID
taskNameYesStringTask name
  • Request an example of Body's parameter
{
"result_type": "SUCCESS", // Task execution result: SUCCESS or FAIL
...
"response": { // Updated context for outputMappings
"xxx": "xxx"
}
}
  • Response:
LO
"result": "ok"
}

Get Workflow Execution Status

  • URL: /flow/get.json
  • Method: GET
  • Request Parameter Description
Parameter NameRequiredTypeDescription
execution_idYesStringWorkflow Execution ID
briefsNobooleanWhether to return brief info (true: only workflow status, false: workflow and node status)
  • Response:
{
"ret": {
"execution_id": "", // Workflow execution ID
"dag_status": "RUNNING", // Workflow execution status
"process": 100, // Current progress of the workflow (100 indicates 100%)
"tasks": { // When brief is true, tasks are not returned. Tasks are a map with node names as keys and node info as values
"startNode": {
"contains_sub": false, // Whether contains sub-nodes
"name": "startNode", // Node name
"next": ["endNode"], // Name of the next node
"status": "NOT_STARTED", // Node status
"task": {
"name": "startNode",
"next": "endNode",
"resourceName": "http://127.0.0.1:8080/flow/sample/start_node.json",
"pattern": "task_sync",
"inputMappings": [ // Input mapping rules
...
],
"outputMappings": [ // Output mapping rules
...
]
}
},
"endNode": {
...
}
}
}
}

Other APIs

  • Project integrated intoSwagger2 framework, full interface description can be accessed at the following address after service starts
http:///127.0.0.1:8080/swagger-ui.html

Effect like Found:

SWAGGER