Get My Flow

模糊查询满足指定条件的所有任务流信息。

前提条件

用户必须属于目标任务流所属的OU。

请求格式

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

请求参数(URI)

名称 位置(Path/Query) 必需/可选 数据类型 描述
userId Query 必需 String 用户ID。如何获取userId信息>>
orgId Query 必需 String 用户所属的组织ID。如何获取orgId信息>>
expression Query 可选 String 指定在 flowId 和 flowName 字段中模糊匹配查询条件(若不指定,则返回当前用户相关的所有任务流)。
action Query 必需 String 固定值:getMyFlow

响应参数

名称 数据类型 描述
data JSONObject FlowSimpInfo结构体的集合,每个FlowSimpInfo包含查询到的一个任务流的基本信息。详见 FlowSimpleInfo结构体

FlowSimpleInfo结构体

示例

{
    "flowId": 2526,
    "editable": true,
    "flowName": "testIns",
    "cycle": "mi"
}

参数

名称 数据类型 描述
flowId Integer 任务流ID。
editable Boolean 任务流是否可编辑。
flowName String 任务流名称。
cycle String 调度周期(M:月;W:周;D:天;H:小时;mi:分钟)。

错误码

参见 通用错误码

示例

请求示例

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

method: GET

返回示例

{
    "code": 0,
    "msg": "OK",
  "data": [
        {
            "flowId": "3318",
            "editable": true,
            "flowName": "reduce_entity",
            "cycle": "D"
        },
        {
            "flowId": "2809",
            "editable": true,
            "flowName": "map",
            "cycle": "D"
        },
        {
            "flowId": "3257",
            "editable": true,
            "flowName": "shell",
            "cycle": "D"
        },
        {
            "flowId": "2515",
            "editable": true,
            "flowName": "testWorkflow122",
            "cycle": "D"
        },
        {
            "flowId": "2980",
            "editable": true,
            "flowName": "8",
            "cycle": "D"
        },
        {
            "flowId": "2979",
            "editable": true,
            "flowName": "integrattt",
            "cycle": "D"
        }
    ]
}

Java SDK调用示例

import com.alibaba.fastjson.JSONObject;
import com.envision.apim.poseidon.config.PConfig;
import com.envision.apim.poseidon.core.Poseidon;
import com.envision.apim.poseidon.request.PoseidonRequest;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

public class SampleCode{
    public static 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;
        }
    }

    @Test
    public void myFlowsTest(){
        //1.在EnOS Console的左边导航栏中点击应用注册。
        //2.点击需调用API的应用,查看基本信息中的AccessKey即为accessKey、SecretKey即为secretKey
        String accessKey = "AccessKey of your APP";
        String secretKey = "SecretKey of your APP";

        //新建一个request 然后把需要的参数传进去存在Query的map中,key是参数名字,value是参数值
        Request request = new Request();
        request.setMethod("GET");

        try {
            JSONObject response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
                    .url("https://{apigw-address}/batch-processing-service/v2.1/flows")
                    .queryParam("orgId", "yourOrgId")
                    .queryParam("userId", "yourUserId")
                    .queryParam("expression", "Data")
                    .queryParam("action", "getMyFlow")
                    .getResponse(request, JSONObject.class);

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