Updated on 2025-08-14 GMT+08:00

Creating a Flow

Function

This API is used to create a flow.

URI

POST Huawei Cloud Astro Zero domain name/u-route/baas/metadata/v1.0/Flow

Request Parameters

Table 1 Request parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Explanation

The flow name.

Constraints

None

Value

Start with a letter and can contain only letters, digits, and single underscores (_). The value cannot use consecutive underscore (_) and cannot end with an underscore. A maximum of 64 characters are allowed.

Default value

None

label

Yes

String

Explanation

The flow label.

Constraints

None

Value

1–64 characters

Default value

None

processType

Yes

String

Explanation

Type of the Flow instance. The options are as follows:

Constraints

None

Value

  • Autolaunched Flow: a flow instance that is automatically started. After the API is called, the logic defined in the Flow model is immediately executed.
  • Event Trigger: A flow that is triggered by an event. The logic defined in the flow model is executed only when the event is triggered. If this type is selected, you must configure events and condition rules.

Default value

Autolaunched Flow

startElement

No

String

Explanation

Start element of a flow, that is, the name of the first diagram element pointed by the start node. For example, if the diagram element pointed by the start node is script0, the start element of the flow is script0.

Constraints

None

Value

None

Default value

None

interviewLabel

No

String

Explanation

Flow instance label.

Constraints

None

Value

None

Default value

None

localUrl

Yes

String

Explanation

Local URL, which consists of /run/ and the flow name. For example, if the flow name is Namespace__das, set the URL to /run/Namespace__das.

Constraints

None

Value

None

Default value

None

event

No

String

Explanation

Flow event.

Constraints

This parameter is mandatory when processType is set to Event Trigger.

Value

None

Default value

None

variables

No

Array

Explanation

Variables bound to the flow instance.

Constraints

This parameter is valid only when processType is set to Event Trigger.

eventCriteria

No

String

Explanation

Trigger condition configured for the event involved in a flow.

Constraints

None

Value

None

Default value

None

Response Parameters

Table 2 Response parameters

Parameter

Type

Description

resCode

String

Explanation

Return code.

Value

If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

resMsg

String

Explanation

Message returned.

Value

If the request is successful, "Success" is returned. In other cases, an error message is returned.

result

Object

Explanation

If the request is successful, the flow ID is returned.

Example Request

Create a flow instance. The flow instance label is das and the name is t__das.
POST https://Huawei Cloud Astro Zero domain name/u-route/baas/metadata/v1.0/Flow
{
    "label": "das",
    "name": "t__das",
    "processType": "Autolaunched Flow",
    "localUrl": "/run/t__das",
    "startElement": "",
    "event": "",
    "eventCriteria": "",
    "interviewLabel": "das {!$Flow.CurrentDateTime}"
}

Example Response

{
    "resCode": "0",
    "resMsg": "Success",
    "result": {
        "errors": [
            "startElement in Flow(t__das) is mandatory."
        ],
        "id": "000y000000aM8XixTN0S",
        "warnings": []
    }
}

Status Code

See Status Codes.

Error Code

See Error Codes.