Help Center/ FunctionGraph/ API Reference/ APIs/ Function Flows/ Querying Metadata of a Flow Instance
Updated on 2024-09-12 GMT+08:00

Querying Metadata of a Flow Instance

Function

This API is used to query the instance metadata of a flow.

URI

GET /v2/{project_id}/fgs/workflows/{workflow_id}

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 ID.

Minimum: 1

Maximum: 512

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

id

String

Unique flow ID.

Minimum: 1

Maximum: 64

workflow_urn

String

Flow URN. Format:urn:fss:<region_id>:<project_id>:workflow:<package>:<workflow_name>:<version>Currently, package and version can only be set to default and latest, respectively.

created_time

String

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

Minimum: 0

Maximum: 64

updated_time

String

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

Minimum: 0

Maximum: 64

created_by

String

Flow creator.

Minimum: 0

Maximum: 64

lts_group_id

String

Log group ID for an express flow. This parameter is returned only when the log level is not NONE.

lts_stream_id

String

Log stream ID for an express flow. This parameter is returned only when the log level is not NONE.

definition

WorkflowCreateBody object

Body for creating a function flow.

Table 3 WorkflowCreateBody

Parameter

Type

Description

name

String

Flow name.

Minimum: 1

Maximum: 64

description

String

Flow description.

Minimum: 1

Maximum: 512

start

String

Start node ID.

Minimum: 1

Maximum: 256

triggers

Array of Trigger objects

Trigger list.

Array Length: 0 - 200

functions

Array of Function objects

Function list.

Array Length: 0 - 100

states

Array of OperationState objects

Node list. For details, see the descriptions of SleepState and OperationState.

Array Length: 1 - 100

constants

Object

Constants.

retries

Array of Retry objects

Retry policies.

Array Length: 0 - 200

mode

String

Flow type.- NORMAL: better for common services that take a long time to execute. Flows of this type support persistence and query of historical execution records and asynchronous invocation.- EXPRESS: better for services that take less than five minutes to execute but need premium performance. Flows of this type support both synchronous and asynchronous invocations, but do not support persistence of historical execution records.By default, NORMAL is used.

Default: NORMAL

Enumeration values:

  • NORMAL
  • EXPRESS

express_config

ExpressConfig object

Express flow configuration. This parameter is required when mode is set to EXPRESS.

enterprise_project_id

String

Enterprise project ID.

Minimum: 0

Maximum: 64

enable_stream_response

Boolean

Whether to return stream data.

Default: false

Table 4 Trigger

Parameter

Type

Description

trigger_name

String

Trigger name.

Minimum: 1

Maximum: 256

trigger_type

String

Trigger type. Options:

  • FLOWTIMER
  • SMN
  • APIG (shared)
  • APIG_DE (dedicated)
  • OBS (OBS triggers are not available in the International regions.)

Minimum: 1

Maximum: 32

Enumeration values:

  • FLOWTIMER
  • SMN
  • APIG
  • APIG_DE
  • OBS

enabled

Boolean

Whether to enable the trigger.

Default: true

Enumeration values:

  • true
  • false

trigger_config

OBSTriggerConfig object

OBS trigger configuration. This parameter is mandatory when trigger_type is set to OBS.

Table 5 OBSTriggerConfig

Parameter

Type

Description

bucket

String

OBS bucket name. This parameter is mandatory when trigger_type is set to OBS.

Minimum: 1

Maximum: 64

events

Array of strings

OBS events. This parameter is mandatory when trigger_type is set to OBS.

Array Length: 1 - 64

prefix

String

Object name prefix, which is mandatory when trigger_type is set to OBS.

Minimum: 1

Maximum: 1024

suffix

String

Object name suffix, which is mandatory when trigger_type is set to OBS.

Minimum: 1

Maximum: 1024

Table 6 Function

Parameter

Type

Description

name

String

Function name, which must be unique in a flow.

Minimum: 0

Maximum: 256

operation

String

Function URN.

Minimum: 0

Maximum: 256

metadata

Object

Custom function attribute.

Table 7 OperationState

Parameter

Type

Description

action_mode

String

Action execution mode. Serial and parallel modes are supported. The default mode is serial.

Minimum: 1

Maximum: 32

Enumeration values:

  • sequential
  • parallel

actions

Array of Action objects

Operations to be performed.

Array Length: 1 - 10

on_errors

Array of OnError objects

Error handling policy.

Array Length: 0 - 200

id

String

Node ID, which must be unique in the flow.

Minimum: 0

Maximum: 64

name

String

Node name.

Minimum: 1

Maximum: 256

type

String

Node type.

Minimum: 1

Maximum: 32

Enumeration values:

  • Operation
  • Sleep
  • End

end

Boolean

Whether the node is an end node.

transition

String

ID of the next node.

Minimum: 0

Maximum: 256

state_data_filter

StateDataFilter object

Filter expression.

duration

Long

Waiting time, in seconds. This parameter is mandatory and valid only when the node type is Sleep.

Minimum: 0.001

Maximum: 86400

Table 8 Action

Parameter

Type

Description

function_ref

FunctionRef object

Function invocation information.

Table 9 FunctionRef

Parameter

Type

Description

ref_name

String

Function reference name, which must be the same as the name in the outer functions.

Minimum: 0

Maximum: 256

invoke_mode

String

Function invocation mode. Currently, only synchronous invocation is supported.

Minimum: 1

Maximum: 32

Enumeration values:

  • synchronize
  • asynchronous

arguments

Object

Input parameters for function execution. Constants can be referenced.

Format: parameter path | constant value/path

The parameter path is the JSONPath (for example, $.a.b[0].c) of an input parameter.

The constant value can be a number, string (enclosed in single quotation marks), or Boolean.

The constant path is the JSONPath of a constant. It must be represented with $CONST for a root node. For example, $CONST.a.b.

Table 10 OnError

Parameter

Type

Description

error

String

Error matching expression, which is used to filter exceptions.

Minimum: 0

Maximum: 256

transition

String

ID of the next node.

Minimum: 0

Maximum: 256

retry_ref

String

Retry policy name.

Minimum: 0

Maximum: 256

Table 11 StateDataFilter

Parameter

Type

Description

input

String

Input filter expression (JSONPath).

Minimum: 0

Maximum: 256

output

String

Output filter expression (JSONPath).

Minimum: 0

Maximum: 256

Table 12 Retry

Parameter

Type

Description

name

String

Retry policy name, which must be unique in a flow.

Minimum: 1

Maximum: 256

delay

Long

Retry interval, in seconds. Default value: 1.

Minimum: 1

Maximum: 30

max_attempts

Long

Maximum number of retry attempts. Default value: 3.

Minimum: 1

Maximum: 8

Table 13 ExpressConfig

Parameter

Type

Description

log_level

String

Execution log level, which is valid only when mode is set to EXPRESS.

Options:

  • ALL: Execution logs of all nodes will be recorded.
  • ERROR: Only execution logs of abnormal nodes will be recorded. NONE: No logs will be recorded.

To set this parameter to ALL or ERROR, enable LTS first.

Minimum: 1

Maximum: 5

Enumeration values:

  • ALL
  • ERROR
  • NONE

Status code: 400

Table 14 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 1

Maximum: 36

error_msg

String

Error description.

Minimum: 2

Maximum: 512

request_id

String

Request ID.

Minimum: 2

Maximum: 512

Status code: 500

Table 15 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

Minimum: 1

Maximum: 36

error_msg

String

Error description.

Minimum: 2

Maximum: 512

request_id

String

Request ID.

Minimum: 2

Maximum: 512

Example Requests

Query the metadata of function flow {workflow_id}.

GET /v2/{project_id}/fgs/workflows/{workflow_id}

Example Responses

Status code: 200

OK

{
  "id" : "fa466a62-73a2-49b9-9261-358dfe873b6e",
  "created_time" : "2022-09-01T01:29:46Z",
  "updated_time" : "2022-09-13T07:27:02Z",
  "workflow_urn" : "urn:fss:cn-north-7:c53626012ba84727b938ca8bf03108ef:workflow:default:flow_nxy:latest",
  "lts_group_id" : "124cef5b-d494-490d-af94-166c4bef0e0d",
  "lts_stream_id" : "07e89ef7-d038-4018-97de-167b255de61f"
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

500

Internal Server Error

Error Codes

See Error Codes.