Trigger Flow From Task

Manually trigger a workflow schedule (run a specified task and its downstream nodes only).

Prerequisites

  • The user must be the owner of the workflow.
  • Both the user and the workflow are not locked.

Request Format

POST https://{apigw-address}/batch-processing-service/v2.1/flows

Request Parameters (URI)

Name Location (Path/Query) Mandatory/Optional Data Type Description
userId Query Mandatory String The user ID. How to get userId>>
orgId Query Mandatory String The organization ID which the user belongs to. How to get orgId>>
action Query Mandatory String Fixed value: triggerFromTask

Request Parameters (Body)

Name Mandatory/Optional Data Type Description
flowId Mandatory Integer The workflow ID.
taskId Mandatory Integer Task node ID (running this task node and its downstream nodes).
triggerTime Mandatory Long

Specify the trigger time of the workflow, keeping in mind the following rules:

  • If the triggering time is before the current time, the workflow will be triggered immediately, and the triggering time will be passed into the time parameters for calculation.
  • The workflow only allows one instance to run at any one time. If the pre-run instance conflicts with a running instance, it will be executed in sequence.

Response Parameters

Name Data Type Description
data FlowInstanceId Struct The details of the workflow instance. For more information, see FlowInstanceId Struct

Error Code

Code Message Description
62102 Invalid request body. The request body format is not correct, or the specified parameters are not valid.
62102 Cannot create workflow instance. Please check if the workflow or task exist, and do not trigger the same workflow repeatedly in 1 minute. Failed to create the workflow instance. Please check if the specified workflow ID or task node ID is correct.
62109 Internal server exception Internal server exception.

For other error codes, see Common Error Codes.

Sample

Request Sample

url: https://{apigw-address}/batch-processing-service/v2.1/flows?action=triggerFromTask&userId={}&orgId={}

method: POST

{
  "flowId": 3377,
  "taskId":108580,
  "triggerTime": 1594016819108
}

Return Sample

{
  "code": 0,
  "msg": "OK",
  "data": {
    "flowInstanceId": "3377-20200706062600"
  }
}

SDK Samples


You can access the SDK samples for batch processing service on GitHub: