Import Flow

Import workflow configuration to create a workflow with the specified name under the specified directory.

Prerequisite

The user must belong to the organization (OU) which the target workflow belongs to.

Request Format

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

Request Parameters (URI)

Name

Location (Path/Query)

Required/Optional

Data Type

Description

userId

Query

Required

String

The user ID. How to get userId>>

orgId

Query

Required

String

The organization ID which the user belongs to. How to get orgId>>

action

Query

Required

String

Fixed value: import

Request Parameters (Body)

Name

Required/Optional

Data Type

Description

flowId

Optional

Integer

The workflow ID. If not specified, the system will generate a flowId. If the specified flowId already exists, the system will generate another flowId).

flowName

Required

String

The workflow name.

desc

Optional

String

The workflow description.

dirId

Required

String

The ID of the directory for the workflow (can be obtained through the List Workflow Directories API).

flowJson

Required

List<JSONObject>

The details of the workflow. For more information, see Flow Struct

Response Parameters

FlowId Struct

Sample

{
  "flowId":2781
}

Parameters

Name

Data Type

Description

flowId

String

The ID of the created workflow.

Error Code

Code

Message

Description

62102

One of the following messages can be returned:

  • Incorrect parameter

  • Invalid parameter: flowName

  • Directory does not exist

  • Workflow validation failed

Invalid parameter

62109

Failed to create workflow

Failed to create the workflow because of internal server exception.

For other error codes, see Common Error Codes.

Samples

Request Sample

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

method: POST

requestBody:
{
  "flowName": "outuser",
  "desc": "",
  "dirId": "dirId",
  "flowJson": {
        "cycle": "D",
        "cron": "0 0 0 * * ? *",
        "parameters": "[{\"key\":\"REPLACE\",\"value\":\"lili1\"}]",
        "submitter": "yourSubmitter",
        "owners": "yourOwners",
        "visitors": "yourVisitors",
        "type": 1,
        "desc": "",
        "tasks": [
            {
                "name": "tass",
                "resource": "default",
                "type": "DATA_INTEGRATION",
                "cmd": "echo "hello"",
                "submitter": "yourSubmitter",
                "filePackage": "",
                "cron": "",
                "priorityLevel": 0,
                "timeout": 300,
                "retryLimit": 3,
                "retryInterval": 0,
                "successCode": "0",
                "asLink": true,
                "runMode": "{\"taskMode\":1,\"cpu\":0.5,\"memory\":1,\"maxParallel\":0,\"keyType\":0,\"datasourceId\":0,\"path\":\"\",\"content\":\"\"}",
                "syncType": 1
            }
        ],
        "relations": [],
        "startTime": "2019-11-22",
        "flowLinks": [],
        "syncType": 1,
        "linkRelations": [],
        "alertMode": 3,
        "taskLinks": []
    }
}

Return Sample

{
  "code": 0,
  "msg": "OK",
  "data": {
    "flowId": 1001
  }
}