List Flow Instances¶
Search workflow instances that meet the specified conditions.
Prerequisites¶
The user must be an EnOS user.
Request Format¶
POST https://{apigw-address}/dataflow-batch-service/v2.0/flowInstances?action=search&userId={}&orgId={}
Request Parameters (URI)¶
Name  | 
Location (Path/Query)  | 
Required or Not  | 
Data Type  | 
Description  | 
|---|---|---|---|---|
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>>  | 
Request Parameters (Body)¶
Name  | 
Required or Not  | 
Data Type  | 
Description  | 
|---|---|---|---|
type  | 
true  | 
Integer  | 
Scheduling type of the workflow instance (0: Manual; 1: Periodic; 2: Temporary)  | 
expression  | 
true  | 
String  | 
Expression for searching workflow instances  | 
owner  | 
true  | 
String  | 
Owner of workflow instance  | 
fromTriggerTime  | 
true  | 
Long  | 
Query start time (by the scheduling start time of the workflow instance)  | 
toTriggerTime  | 
true  | 
Long  | 
Query end time (by the scheduling start time of the workflow instance)  | 
status  | 
true  | 
String  | 
Status of the workflow instance  | 
pagination  | 
false  | 
Pagination Struct  | 
Paging parameter. See Pagination Struct  | 
Response Parameters¶
Name  | 
Data Type  | 
Description  | 
|---|---|---|
data  | 
FlowInstances  | 
List of searched workflow instances and the count. See FlowInstances Struct  | 
FlowInstances Struct¶
Sample¶
{
    "flowInsts":[],
    "count":0
}
Parameters¶
Name  | 
Data Type  | 
Description  | 
|---|---|---|
flowInsts  | 
List<FlowInstance>  | 
Collection of workflow instances. See FlowInstance Struct  | 
count  | 
Integer  | 
Number of searched workflow instances (number of elements in the FlowInstance struct)  | 
Error Code¶
Code  | 
Message  | 
Description  | 
|---|---|---|
62102  | 
illegal sorted by field  | 
The provided sortedBy parameter is invalid. Valid options are: 
  | 
Sample¶
Request Sample¶
url: https://{apigw-address}/dataflow-batch-service/v2.0/flowInstances?action=search&userId={}&orgId={}
method: POST
requestBody:
{
    "type": 1,
    "fromTriggerTime": 1573648355000,
    "toTriggerTime": 1573698120000,
    "status": 1,
    "owner": "",
    "expression": "",
    "pagination":{
        "pageNo": 0,
        "pageSize": 10,
        "sorters": [{
            "field": "update_time",
            "order": "ASC"
        }]
    }
}
Return Sample¶
{
  "status": 0,
  "msg": " Success",
  "data": {
    "flowInsts": [{
                "instanceId": "2809-20190812080700",
                "flowId": 2809,
                "flowName": "21",
                "freq": "0 0 0 * * ? *",
                "cycle": "D",
                "parameters": "[]",
                "doAs": "data_oxxxxx",
                "graph": "{"creator":"xxxx","freq":"0 0 0 * * ? *","alert_mode":3,"owners":"xxxx","cycle":"D","do_as":"data_oxxxxx","flows":[],"alert_to":"","name":"21","inst_id":"2809-20190812080700","id":2809,"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": 1,
                "statusDesc": "SUCCESS",
                "triggerTime": "2019-08-12 08:07:22",
                "startTime": "2019-08-12 08:07:30",
                "endTime": "2019-08-12 08:07:32",
                "timestamp": "2019-08-12 08:09:48.0",
                "virtual": false,
                "owner": "xxxxx",
                "hasEditPri": true,
                "hasReadPri": true,
                "isCancelled": false
            },
            {
                "instanceId": "2957-20190812075600",
                "flowId": 2957,
                "flowName": "fdd",
                "freq": "0 0 0 * * ? *",
                "cycle": "D",
                "parameters": "[]",
                "doAs": "data_oxxxxxxx",
                "graph": "{"creator":"xxxx","freq":"0 0 0 * * ? *","alert_mode":3,"owners":";xxxx;","cycle":"D","do_as":"data_oxxx","flows":[],"alert_to":"","name":"fdd","inst_id":"2957-20190812075600","id":2957,"relations":[],"parameters":"[]","app_id":"","tasks":[{"task_name":"gg","task_inst_id":"105040-20190812075600","x":0.0068,"y":0.0071,"task_id":105040,"node_id":"t_105040"}]}",
                "status": 1,
                "statusDesc": "SUCCESS",
                "triggerTime": "2019-08-12 07:56:56",
                "startTime": "2019-08-12 07:57:00",
                "endTime": "2019-08-12 07:57:02",
                "timestamp": "2019-08-12 08:00:09.0",
                "virtual": false,
                "owner": "xxxxxxxx",
                "hasEditPri": true,
                "hasReadPri": true,
                "isCancelled": false
            }],
    "count": 2
  }
}
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 flowInstancesTest(){
        //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 = "****************";
        String secretKey = "****************";
        //Create a request and save the required parameters in the map of the Query.
        Request request = new Request();
            HashMap<String,Object> bodyMap = new HashMap<>();
            bodyMap.put("type",0);
        bodyMap.put("owner","");
        bodyMap.put("startTriggerTime",1565568000000L);
        bodyMap.put("endTriggerTime",1565654399999L);
        bodyMap.put("status","");
            bodyMap.put("expression","");
        HashMap<String,Object> paginationMap= new HashMap<String, Object>(3);
        paginationMap.put("pageNo",0);
        paginationMap.put("pageSize",10);
        List<HashMap<String,Object>> list = new ArrayList<HashMap<String,Object>>();
        HashMap<String,Object> sorterMap= new HashMap<String, Object>(2);
        sorterMap.put("field","update_time");
        sorterMap.put("order","ASC");
        list.add(sorterMap);
        paginationMap.put("sorters",list );
        bodyMap.put("pagination",paginationMap);
        request.setQueryParam("userId","your_userId");
        request.setQueryParam("orgId","your_orgId");
        request.setBodyParam(bodyMap);
        request.setMethod("POST");
        try {
            JSONObject response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
                    .url("https://{apigw-address}/dataflow-batch-service/v2.0/flowInstances?action=search")
                    .getResponse(request, JSONObject.class);
            System.out.println(response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }