Get Flow

Get the information of a specified workflow.

Prerequisites

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

Request Format

GET https://{apigw-address}/dataflow-batch-service/v2.0/flows?action=get&flowId={}&userId={}&orgId={}

Request Parameters (URI)

Name

Location (Path/Query)

Required or Not

Data Type

Description

flowId

Query

true

Integer

Workflow ID

userId

Query

true

String

User ID. How to get userId>>

orgId

Query

true

String

Organization ID which the user belongs to. How to get orgId>>

Response Parameters

Name

Data Type

Description

data

Flow Struct

Detailed information of the workflow. See Flow Struct

Flow Struct

Sample

{
    "virtual": false,
    "freq": "0 0 0 * * ? *",
    "type": 1,
    "cycle": "D",
    "alertMode": 3,
    "appId": "",
    "hasEditPri": true,
    "startTime": "2019-07-18",
    "locked": false,
    "flowId": 2430,
    "owner": " owner",
    "creator": " creator",
    "active": 0,
    "updateUser": "xxxxxxx",
    "updateTime": "2019-07-18 07:50:36.0",
    "flowName": "yu",
    "graph": "{
"queue":"","cycle":"D","desc":"","do_as":"db_xxxx","freq":"0 0 0 * * ? *","visitors":"","tasks":[{"task_name":"hello","task_id":"104443","y":0.0071,"x":0.0096,"node_id":"t_104443"}],"type":1,"creator":"xxxx","flows":[],"alert_mode":3,"relations":[],"name":"yu","start_time":"2019-07-18","active":0,"parameters":"[]","owners":";xxx;"
}",
    "isUserLocked": false,
    "entry": 2,
    "doAs": "db_xxxxx",
    "createTime": "2019-07-18 07:49:10.0",
    "alertTo": "",
    "visitor": ";xxxxx;",
    "syncType": 1,
    "parameters": "[]",
    "hasReadPri": true,
    "desc": ""
  }

Parameters

Name

Data Type

Description

flowId

Integer

Workflow ID

flowName

String

Name of the workflow

active

Integer

Scheduling status of the workflow (0: Pause; 1: Start)

creator

String

User who created the workflow

createTime

String

Time when the workflow is created

updateUser

String

User who updated the workflow

updateTime

String

Time when the workflow is updated

freq

String

If CronTab syntax is used when specifying the time to start the workflow in a scheduling cycle, a 7-character CronTab expression is used. For more information about CronTab, see http://cron.qqe2.com/

cycle

String

Scheduling cycle (M: Month; W: Week; D: Day; H: Hour; mi: Minute)

parameters

List<Map<key,value>>

Global parameters that are configured for the workflow to dynamically adapt to the environment changes (in the format of key=value).

owner

String

Owner of the workflow

visitor

String

Users who can access the workflow (separated by semicolon)

doAs

String

OU account which the workflow belongs to

alertMode

Integer

Alert mode (0: Not enabled; 1: Email; 2: SMS; 3: Email and SMS)

alertTo

String

Receiver of alerts

appId

String

Null string

graph

FlowGraph Struct

Workflow dependency of the workflow. See FlowGraph Struct

entry

Integer

Method used for creating the workflow (0: Portal; 1: API; 2: eos)

type

Integer

Scheduling type of the workflow (0: Manual; 1: Periodic; 2: Temporary)

syncType

Integer

Sync type of the workflow (0: File synchronization; 1: Data synchronization)

desc

String

Description of the workflow

startTime

String

Effective date of the workflow

virtual

Boolean

Whether the workflow is a virtual workflow

locked

Boolean

Whether the workflow is locked

hasEditPri

Boolean

Whether the user has editing permission to the workflow

hasReadPri

Boolean

Whether the user has reading permission to the workflow

isUserLocked

Boolean

Whether the user is locked

FlowGraph Struct

Sample

{
  "creator":"xxxxx",
  "freq":"0 0 0 * * ? *",
  "alert_mode":3,
  "type":1,
  "owners":"xxxxx",
  "visitors":";xxx; ",
  "start_time":"2019-07-25"
  "cycle":"D",
  "do_as":"data_oxxxxx",
  "flows":[],
  "alert_to":"",
  "name":"21",
  "syncType":1,
  "relations":[],
  "parameters":"[]",
  "app_id":"",
  "tasks":
      [{
      "task_name":"tass",
      "task_inst_id":"104890-20190812080700",
      "x":0.002,
      "y":0.002,
      "task_id":104890,
      "node_id":"t_104890",
      "status":"CANCEL"}]
  "queue":"",
  "desc":"ga"
}

Parameters

Name

Data Type

Description

creator

String

User who created the workflow instance

freq

String

If CronTab syntax is used when specifying the time to start the workflow in a scheduling cycle, a 7-character CronTab expression is used. For more information about CronTab, see http://cron.qqe2.com/

alert_mode

Integer

Alert mode (0: Not enabled; 1: Email; 2: SMS; 3: Email and SMS)

type

Integer

Scheduling type of the workflow (0: Manual; 1: Periodic; 2: Temporary)

owners

String

Owner of the workflow instance

visitors

String

Users who can access the workflow (separated by semicolon)

start_time

String

Effective date of the workflow

cycle

String

Scheduling cycle (M: Month; W: Week; D: Day; H: Hour; mi: Minute)

do_as

String

OU account which the workflow belongs to

flows

List<FlowSimpleInfo>

Collection of workflows that have dependency relation with the workflow. See FlowSimpleInfo Struct

alert_to

String

Receiver of alerts

name

String

Workflow name

syncType

Integer

Sync type of the workflow (0: File synchronization; 1: Data synchronization)

relations

List<Relation>

Collection of task relations, with each element representing the upstream and downstream dependency between tasks in the workflow. See Relation Struct

parameters

List<Map<key,value>>

Parameters that are configured for the task to dynamically adapt to the environment changes (by the format of key=value)

app_id

String

Null string

tasks

List<TaskSimpleInfo>

Collection of all task nodes in the workflow, with each element representing a TaskSimpleInfo struct, which contains basic information of a task node. See TaskSimpleInfo Struct

queue

String

Computing queue

desc

String

Description of the workflow

FlowSimpleInfo Struct

Sample

{
    "flow_id":"2809",
    "flow_name":"21",
    "node_id":"f_2809",
    "is_virtual":false,
    "x":0.0125,
    "y":0.0015
}

Parameters

Name

Data Type

Description

flow_id

String

Workflow ID

flow_name

String

Name of workflow

node_id

String

ID of the node that is part of other workflows

is_virtual

Boolean

Whether the workflow is a virtual workflow

x

Double

X-axis of the node on the configuration panel of the workflow

y

Double

Y-axis of the node on the configuration panel of the workflow

TaskSimpleInfo Struct

Sample

{
  "task_name":"tass",
  "x":0.0132,
  "y":0.008100000381469727,
  "task_id":"104575",
  "node_id":"t_104575"
}

Parameters

Name

Data Type

Description

task_name

String

Name of task

x

Double

X-axis of the task on the configuration panel

y

Double

Y-axis of the task on the configuration panel

task_id

String

Task ID

node_id

String

Node ID (Note: Node ID is not the same with task ID, because there are task nodes and workflow nodes that have dependency relations in a workflow)

Relation Struct

Sample

{
    cycle_gap: "D0",
    rerun: true,
    source: "t_105048",
    target: "t_104575"
}

Parameters

Name

Data Type

Description

cycle_gap

String

Scheduling time difference between upstream and downstream tasks, by the format of {cycle}{offset} (cycle is the unit of time different, and offset is value)

source

String

Node ID of the upstream task

target

String

Node ID of the downstream task

rerun

Boolean

Whether the downstream task will be started when rerunning (effective only for task-level rerunning)

Error Code

See Common Error Codes.

Sample

Request Sample

url: https://{apigw-address}/dataflow-batch-service/v2.0/flows?action=get&flowId=2479&userId={}&orgId={}

method: GET

Return Sample

{
  "status": 0,
  "msg": " Success",
  "data": {
    "flowId": 2479,
    "flowName": "test0722-1",
    "active": 0,
    "creator": "xxxx",
    "createTime": "2019-07-22 08:56:35.0",
    "updateUser": "xxxx",
    "updateTime": "2019-07-22 08:56:58.0",
    "freq": "0 0 0 * * ? *",
    "cycle": "D",
    "parameters": "[{"key":"ouids","value":"oxxxxxxxx"},{"key":"path","value":"/user/db_henglin/test_0722-1/"},{"key":"overwrite","value":"true"}]",
    "owner": "xxxx",
    "visitor": ";xxxx;",
    "doAs": "db_xxxx",
    "alertMode": 1,
    "alertTo": "",
    "appId": "",
    "graph": "{"queue":"","cycle":"D","desc":"","do_as":"db_xxxx","freq":"0 0 0 * * ? *","visitors":"","tasks":[{"task_name":"MDM-Sync","task_id":"104506","y":0.002,"x":0.002,"node_id":"t_104506"},{"task_name":"MDMHive","task_id":"104507","y":0.009,"x":0.002,"node_id":"t_104507"}],"type":0,"creator":"xxxx","flows":[],"alert_mode":1,"relations":[{"cycle_gap":"D0","rerun":true,"source":"t_104506","target":"t_104507"}],"name":"test0722-1","start_time":"2019-07-22","active":0,"parameters":"[{"key":"ouids","value":"oxxxxxxxxxxx"},{"key":"path","value":"/user/db_henglin/test_0722-1/"},{"key":"overwrite","value":"true"}]","owners":";xxxxx;"}",
    "entry": 0,
    "type": 0,
    "syncType": 1,
    "desc": "",
    "startTime": "2019-07-22",
    "virtual": false,
    "locked": false,
    "hasEditPri": false,
    "hasReadPri": true,
    "isUserLocked": false
  }
}

Java SDK Sample

import com.alibaba.fastjson.JSONObject;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;

public class Request extends PoseidonRequest {
    public void setQueryParam(String key, Object value){
        QueryParams().put(key, value);
    }
    public void setHeaderParam(String key, String value){
        headerParams().put(key, value);
    }
    public void setBodyParam(Map<String, Object> bodyPara){
        bodyParams().putAll(bodyPara);
    }
    public void setMethod(String method) {
        this.method = method;
    }
    private String method;
    public String baseUri() {
        return "";
    }
    public String method() {
        return method;
    }
}

public void getFlowTest(){
        //1. Select Application Registration from the left navigation bar of EnOS Console.
        //2. Open the App Detail page to get the AccessKey and SecretKey of the application.
        String accessKey = "xxxxxxxxxxxxxxx";
        String secretKey = "xxxxxxxxxxxxxxx";

        //Create a request and save the required parameters in the map of the Query.
        Request request = new Request();
        request.setQueryParam("flowId",2791);
        request.setQueryParam("userId","your_userId");
        request.setQueryParam("orgId","your_orgId");
        request.setMethod("GET");

        try {
            JSONObject response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
                    .url("https://{apigw-address}/dataflow-batch-service/v2.0/flows?action=get")
                    .getResponse(request, JSONObject.class);

            System.out.println(response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }