Load Flow For Edit¶
将指定任务流同步到临时任务流,并获取该任务流信息。
前提条件¶
用户必须属于目标任务流所属的OU。
请求格式¶
GET https://{apigw-address}/batch-processing-service/v2.1/flows
请求参数(URI)¶
名称 |
位置(Path/Query) |
必需/可选 |
数据类型 |
描述 |
---|---|---|---|---|
flowId |
Query |
必需 |
Integer |
任务流ID。 |
userId |
Query |
必需 |
String |
用户ID。如何获取userId信息>> |
orgId |
Query |
必需 |
String |
用户所属的组织ID。如何获取orgId信息>> |
action |
Query |
必需 |
String |
固定值:loadForEdit |
响应参数¶
名称 |
数据类型 |
描述 |
---|---|---|
data |
List<JSONObject> |
包含任务流的详细信息。详见 Flow结构体 |
错误码¶
参见 通用错误码。
示例¶
请求示例¶
url: https://{apigw-address}/batch-processing-service/v2.1/flows?action=loadForEdit&flowId=2515&userId={}&orgId={}
method: GET
返回示例¶
{
"code": 0,
"msg": "OK",
"data": {
"virtual": false,
"freq": "0 0 0 * * ? *",
"type": 1,
"cycle": "D",
"alertMode": 3,
"hasEditPri": true,
"startTime": "2019-07-23",
"locked": false,
"flowId": 2515,
"owner": "yourOwners",
"creator": "yourCreator",
"updateUser": "yourUpdateUser",
"active": 0,
"updateTime": "2019-08-08 05:51:43.0",
"flowName": "fpostm",
"graph": "{\"creator\":\"yourCreator\",\"freq\":\"0 0 0 * * ? *\",\"alert_mode\":3,\"active\":0,\"owners\":\"yourOwners\",\"type\":1,\"cycle\":\"D\",\"start_time\":\"2019-07-23\",\"visitors\":\"yourVisitors\",\"do_as\":\"yourDaAs\",\"flows\":[{\"is_virtual\":false,\"flow_id\":\"2788\",\"x\":0.0186,\"flow_name\":\"jin\",\"y\":0.0016999999046325683,\"node_id\":\"f_2788\"},{\"is_virtual\":true,\"flow_id\":\"2819\",\"x\":8.0E-4,\"flow_name\":\"104891(tass)\",\"y\":0.022100001525878907,\"node_id\":\"f_2819\"}],\"name\":\"fpostm\",\"relations\":[{\"cycle_gap\":\"D0\",\"source\":\"t_104575\",\"rerun\":true,\"target\":\"t_104590\"},{\"cycle_gap\":\"D0\",\"source\":\"f_2788\",\"rerun\":false,\"target\":\"t_104575\"},{\"cycle_gap\":\"D0\",\"source\":\"f_2819\",\"rerun\":false,\"target\":\"t_104590\"}],\"parameters\":\"[]\",\"queue\":\"\",\"tasks\":[{\"task_name\":\"tass\",\"x\":0.0132,\"y\":0.008100000381469727,\"task_id\":\"104575\",\"node_id\":\"t_104575\"},{\"task_name\":\"gg\",\"x\":0.0084,\"y\":0.014199999237060546,\"task_id\":\"104590\",\"node_id\":\"t_104590\"}],\"desc\":\"e\"}",
"isUserLocked": false,
"entry": 1,
"doAs": "your_bd_account",
"createTime": "2019-07-26 05:41:58.0",
"syncType": 1,
"visitor": "yourVisitors",
"parameters": "[]",
"queue": "",
"hasReadPri": true,
"desc": "e"
}
}
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 loadFlowTest(){
//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("flowId", "36")
.queryParam("action", "loadForEdit")
.getResponse(request, JSONObject.class);
System.out.println(response);
} catch (Exception e) {
e.printStackTrace();
}
}
}