Search Flow¶
Search the basic information of workflows that meet the search criteria (including workflows of other users in the organization (OU)).
Prerequisite¶
The user must belong to the OU which the target workflows belong to.
Request Format¶
POST https://{apigw-address}/batch-processing-service/v2.1/flows
Request Parameters (URI)¶
Name |
Location (Path/Query) |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|---|
userId |
Query |
Mandatory |
String |
The user ID. How to get userId>> |
orgId |
Query |
Mandatory |
String |
The organization ID which the user belongs to. How to get orgId>> |
action |
Query |
Mandatory |
String |
Fixed value: search |
Request Parameters (Body)¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
expression |
Optional |
String |
The search criteria, supporting fuzzy matching query for the |
pagination |
Mandatory |
Pagination Struct |
Lists the paging requirements in a request. For more details, see Pagination Struct |
Pagination Struct¶
Sample¶
{
"pagination": {
"pageNo": 1,
"pageSize": 10,
"sorters": [{
"field": "start_time",
"order": "ASC"
}]
}
}
Parameters¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
pageNo |
Mandatory |
Integer |
The request pages, starting from 1. |
pageSize |
Mandatory |
Integer |
The number of records in each page, which must be greater than 0. For optimal performance, it is recommended to have not more than 50 records per page. |
sorters |
Optional |
jsonArray |
The pagination sorting method.(The sorters struct contains two fields: sorter.field and sorter.order, see the sorters parameter below for details.) |
sorters¶
Name |
Mandatory/Optional |
Data Type |
Description |
---|---|---|---|
field |
Mandatory |
String |
The pagination field name. Supported fields are: create_time, update_time, start_time. |
order |
Optional |
String |
|
Response Parameters¶
Name |
Data Type |
Description |
---|---|---|
data |
Array of PageFlow Structs |
The list of PageFlow structs, which contain the basic information of searched workflows. For more details, see PageFlow Struct |
PageFlow Struct¶
Sample¶
{
"flowId": "21",
"flowName": "dim_wtg_full"
}
Parameters¶
Name |
Data Type |
Description |
---|---|---|
flowId |
Integer |
The workflow ID. |
flowName |
String |
The workflow name. |
Error Code¶
See Common Error Codes.
Samples¶
Request Sample¶
url: https://{apigw-address}/batch-processing-service/v2.1/flows?action=search&userId=yourUserId&orgId=yourOrgId
method: POST
requestBody:
{
"expression": "",
"pagination":{
"pageNo": 1,
"pageSize": 10,
"sorters": [{
"field": "update_time",
"order": "ASC"
}]
}
}
Return Sample¶
{
"code": 0,
"msg": "OK",
"data": [
{
"flowId": "20",
"flowName": "vd_text"
},
{
"flowId": "21",
"flowName": "dim_wtg_full"
},
{
"flowId": "22",
"flowName": "wenl_dim_fact_downtime"
}
]
}
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 pagingFlowsTest(){
//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 = "yourAppAccessKey";
String secretKey = "yourAppSecretKey";
//Create a request and save the required parameters in the map of the Query.
Request request = new Request();
request.setQueryParam("userId","yourUserId");
request.setQueryParam("orgId","yourOrgId");
HashMap<String,Object> bodyMap= new HashMap<String, Object>(2);
bodyMap.put("expression","");
HashMap<String,Object> paginationMap= new HashMap<String, Object>(3);
paginationMap.put("pageNo",1);
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","updateTime");
sorterMap.put("order","ASC");
list.add(sorterMap);
paginationMap.put("sorters",list);
bodyMap.put("pagination",paginationMap);
request.setBodyParam(bodyMap);
request.setMethod("POST");
try {
JSONObject response = Poseidon.config(PConfig.init().appKey(accessKey).appSecret(secretKey).debug())
.url("https://{apigw-address}/batch-processing-service/v2.1/flows?action=search")
.getResponse(request, JSONObject.class);
System.out.println(response);
} catch (Exception e) {
e.printStackTrace();
}
}