Help Center/ FunctionGraph/ API Reference/ APIs/ Function Flows/ Executing a Flow Synchronously
Updated on 2024-01-12 GMT+08:00

Executing a Flow Synchronously

Function

This API is used to execute an express flow synchronously. It is available only in the Chinese mainland regions.

URI

POST /v2/{project_id}/fgs/workflows/{workflow_id}/sync-executions

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

Minimum: 1

Maximum: 64

workflow_id

Yes

String

Flow definition ID.

Minimum: 1

Maximum: 512

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

headers

No

Object

Headers for flow execution.

input

Yes

Object

Input parameters for flow execution. You can use JSONPath for parameter mapping and specify a default value.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

execution_id

String

Flow instance ID.

Minimum: 1

Maximum: 64

status

String

Flow execution status.

Minimum: 1

Maximum: 64

Enumeration values:

  • success

  • fail

  • timeout

output

Object

Flow execution result in JSON format. This parameter has a value only when the status is success.

errors

Array of SyncExecutionNodeErrorDetail objects

Flow execution error information. This parameter has a value only when status is fail.

Array Length: 0 - 200

begin_time

String

Flow instance creation time (UTC), in the format yyyy-MM-ddTHH:mm:ssZ.

Minimum: 0

Maximum: 64

end_time

String

Flow instance end time (UTC), in the format yyyy-MM-ddTHH:mm:ssZ.

Minimum: 0

Maximum: 64

Table 4 SyncExecutionNodeErrorDetail

Parameter

Type

Description

node_id

String

Flow node ID.

Minimum: 1

Maximum: 64

error_message

String

Error details.

Minimum: 1

Maximum: 2048

begin_time

String

Flow instance creation time (UTC), in the format yyyy-MM-ddTHH:mm:ssZ.

Minimum: 0

Maximum: 64

end_time

String

Flow instance end time (UTC), in the format yyyy-MM-ddTHH:mm:ssZ.

Minimum: 0

Maximum: 64

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 1

Maximum: 36

error_msg

String

Error description.

Minimum: 2

Maximum: 512

Status code: 404

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 1

Maximum: 36

error_msg

String

Error description.

Minimum: 2

Maximum: 512

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 1

Maximum: 36

error_msg

String

Error description.

Minimum: 2

Maximum: 512

Example Requests

Execute a flow synchronously.

POST /{project_id}/fgs/workflows/{workflow_id}/sync-executions

{
  "headers" : {
    "tenantId" : "user1"
  },
  "input" : {
    "arg1" : "argument_1",
    "arg2" : "argument_2"
  }
}

Example Responses

Status code: 200

Success

{
  "execution_id" : "48aff955-ea10-4ffd-b426-190bc192dc14",
  "status" : "success",
  "output" : {
    "result" : 200,
    "message" : "success"
  },
  "errors" : [ {
    "node_id" : "48aff955-ea10-4ffd-b426-190bc192dc14",
    "error_message" : "Exception happened",
    "begin_time" : "2021-01-01T00:00:00Z",
    "end_time" : "2021-01-01T00:00:00Z"
  } ],
  "begin_time" : "2021-01-01T00:00:00Z",
  "end_time" : "2021-01-01T00:00:00Z"
}

Status Codes

Status Code

Description

200

Success

400

Bad Request

404

Bad Request

500

Internal Server Error

Error Codes

See Error Codes.