LoadBizObjects批量加载业务数据,最大一次性加载500条。
请求方式:POST(HTTPS)
请求地址:https://www.h3yun.com/OpenApi/Invoke
请求包体:
{ "ActionName":"LoadBizObjects", "SchemaCode":"D000024chuangjian", "Filter":"{\"FromRowNum\": 0,\"RequireCount\": false,\"ReturnItems\": [], \"SortByCollection\": [],\"ToRowNum\": 500, \"Matcher\": { \"Type\": \"And\", \"Matchers\": []}}" } |
参数说明:
参数 | 参数类型 | 必须 | 说明 |
ActionName | String | 是 | 调用的方法名 |
SchemaCode | String | 是 | 需要查询的表单编码 |
Filter | String | 是 | 过滤条件。默认返回前500条数据 |
需要注意:使用该方法读取子表附件时,需要将子表schemacode和objectid作为参数传入读取,
读取主表单数据时不会带出子表附件信息。
Filter参数说明:
参数 | 参数类型 | 必须 | 说明 |
FromRowNum | String | 是 | 分页查询,从第几条开始 |
RequireCount | String | 是 | 查询的总行数 |
ReturnItems | String | 是 | 返回的字段,不填返回所有 |
SortByCollection | String | 是 | 排序字段,目前不支持使用,默认置空 |
ToRowNum | String | 是 | 分页查询,第几条结束 |
Matcher | String | 是 | 查询条件 |
Filter示例:
{ "ActionName": "LoadBizObjects", "SchemaCode": "D000024chuangjian", "Filter": "{\"FromRowNum\":0,\"ToRowNum\":500,\"Matcher\":{\"Type\":\"And\", \"Matchers\":[{\"Type\":\"And\",\"Matchers\":[{\"Type\":\"Item\",\"Name\":\"SeqNo\",\"Operator\":2,\"Value\":\"201900000001\"}]},{\"Type\":\"And\",\"Matchers\":[{\"Type\":\"Item\",\"Name\":\"Title\",\"Operator\":2,\"Value\":\"标1\"}]},{\"Type\":\"Or\",\"Matchers\":[{\"Type\":\"Item\",\"Name\":\"Like\",\"Operator\":8,\"Value\":\"选项2\"}]}]},\"SortByCollection\":[],\"RequireCount\":false}" }
相当于:SELECT * FROM I_D00021TestFilter WHERE SeqNo = '201900000001' AND Title = '标题1' OR Contains(Like, "选项2")
Name为字段名,Operator为运算符,Value为数值。 Operator运算符:0 =大于,1=大于等于,2=等于,3=小于等于,4=小于,5=不等于,6=在某个范围内,7=不在某个范围内。 |
请求示例(C#):
string apiAddress = @"https://www.h3yun.com/OpenApi/Invoke"; HttpWebRequest request = (System.Net.HttpWebRequest)WebRequest.Create(apiAddress); request.Method = "POST"; request.ContentType = "application/json"; //身份认证参数 request.Headers.Add("EngineCode", ""); request.Headers.Add("EngineSecret",""); //参数 Dictionary<string, object> dicParams = new Dictionary<string, object>(); dicParams.Add("ActionName", "LoadBizObjects"); dicParams.Add("SchemaCode", "D000024chuangjian"); dicParams.Add("Filter","{\"FromRowNum\": 0,\"RequireCount\": false,\"ReturnItems\": [], \"SortByCollection\": [],\"ToRowNum\": 500, \"Matcher\": { \"Type\": \"And\", \"Matchers\": []}}");
string jsonData = JsonConvert.SerializeObject(dicParams); byte[] bytes; bytes = System.Text.Encoding.UTF8.GetBytes(jsonData); request.ContentLength = bytes.Length; using (Stream writer = request.GetRequestStream()) { writer.Write(bytes, 0, bytes.Length); writer.Close(); }
string strValue = string.Empty; using (System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse()) { using (System.IO.Stream s = response.GetResponseStream()) { string StrDate = string.Empty; using (StreamReader Reader = new StreamReader(s, Encoding.UTF8)) { while ((StrDate = Reader.ReadLine()) != null) { strValue += StrDate + "\r\n"; } } } } |
请求示例(JAVA):
Map<String, String> paramMap = new HashMap(); paramMap.put("ActionName", "LoadBizObjects"); paramMap.put("SchemaCode", "D000024chuangjian"); paramMap.put("Filter","{\"FromRowNum\": 0,\"RequireCount\": false,\"ReturnItems\": [], \"SortByCollection\": [],\"ToRowNum\": 500, \"Matcher\": { \"Type\": \"And\", \"Matchers\": []}}");
//身份认证参数 Map headers = new HashMap(); headers.put("EngineCode",""); headers.put("EngineSecret","");
Gson gson = new Gson(); String result = HttpRequestUtil.sendPost(url, gson.toJson(paramMap), headers); |
返回结果:
{ "Successful": true, "ErrorMessage": null, "Logined": false, "ReturnData": { "BizObjectArray": [ { "ObjectId": "fea0ade0-505d-4ffc-bca0-6cbdf3c302c6", "Name": "123", "ModifiedBy": "System", "ModifiedTime": "2019/6/12 14:32:06", "WorkflowInstanceId": "f6a030fc-1311-4877-bc88-cb2649a8f784", "Status": 2, "OwnerId": "System", "F0000028": null, "F0000002": null,
"ModifiedByObject": { "ObjectId": "18f923a7-5a5e-426d-94ae-a55ad1a4b239", "Name": "System" }, "OwnerIdObject": { "ObjectId": "f3f69a49-edf6-468d-9aee-8cbc82a46662", "Name": "System" }, "CreatedByObject": { "ObjectId": "f3f69a49-edf6-468d-9aee-8cbc82a46662", "Name": "System" }, "OwnerDeptIdObject": { "ObjectId": "04204118-a9d4-42bf-898b-1cb2f2f73e29", "Name": "System" } }, { "ObjectId": "83de1dfa-9043-4eb8-9943-36849c58ce0e", "Name": "", "ModifiedBy": "", "ModifiedTime": "2019/6/11 17:33:25", "WorkflowInstanceId": "", "Status": 0, "OwnerId": "System", "F0000028": "", "F0000002": "", "OwnerIdObject": { "ObjectId": "f3f69a49-edf6-468d-9aee-8cbc82a46662", "Name": "System" }, "CreatedByObject": { "ObjectId": "f3f69a49-edf6-468d-9aee-8cbc82a46662", "Name": "System" }, "OwnerDeptIdObject": { "ObjectId": "04204118-a9d4-42bf-898b-1cb2f2f73e29", "Name": "Syste " } } ] }, "DataType": 0 } |
参数 | 说明 |
Successful | 返回结果是否成功true/false |
ErrorMessage | 错误信息 |
Logined | 未使用,忽略 |
ReturnData | 返回的数据 |
DataType | 返回的数据类型,默认0 |
文章反馈
*请选择您遇到的问题类型?
*请描述问题详情
支持上传9张图片且单张大小不超过3M