批量创建业务数据
更新时间: 2023-12-01 浏览次数: {{ hits }}

CreateBizObjects:   批量创建数据。

请求方式:POST(HTTPS)

请求地址:https://www.h3yun.com/OpenApi/Invoke

请求包体:

{

"ActionName":"CreateBizObjects",

"SchemaCode":"D000024chuangjian",

"BizObjectArray":["{

        \"CreatedBy\":   \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",

        \"OwnerId\":   \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",

        \"F0000002\": \"123\",

        \"F0000009\":   \"03ea2021-f7d5-4001-b996-7115e63f4319;6d1af175-a49d-48ad-bc3e-52aa35bb34df;db4d0ace-9a0c-4c57-bc3d-47138856c6a6\",

        \"D000024Fdetail123\": [

            {

            \"zh\":   \"123\"

            },

            {

            \"zh\":   \"312\"

            }

          ]

}","{

        \"CreatedBy\":   \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",

        \"OwnerId\":   \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",

        \"F0000002\": \"123\",

        \"F0000009\":   \"03ea2021-f7d5-4001-b996-7115e63f4319;6d1af175-a49d-48ad-bc3e-52aa35bb34df;db4d0ace-9a0c-4c57-bc3d-47138856c6a6\",

        \"D000024Fdetail123\": [

            {

            \"zh\":   \"123\"

            },

            {

              \"zh\":   \"312\"

            }

          ]

}"],

"IsSubmit":"true"

}

 

参数说明:

参数

参数类型

必须

说明

ActionName

String

调用的方法名

SchemaCode

String

表单编码

BizObjectArray

String

BizObject[]对象的json数组

IsSubmit

Bool

为true时创建生效数据,false为草稿数据

 

请求示例(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", "CreateBizObjects");

dicParams.Add("SchemaCode", "D000024chuangjian");

List<string> Chendd = new List<string>();

Chendd.Add("{\"CreatedBy\":   \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",\"OwnerId\":   \"f3f69a49-edf6-468d-9aee-8cbc82a46662\", \"F0000002\":   \"123\",\"F0000009\": \"03ea2021-f7d5-4001-b996-7115e63f4319;6d1af175-a49d-48ad-bc3e-52aa35bb34df;db4d0ace-9a0c-4c57-bc3d-47138856c6a6\"}");

Chendd.Add("{\"CreatedBy\":   \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",\"OwnerId\":   \"f3f69a49-edf6-468d-9aee-8cbc82a46662\", \"F0000002\":   \"123\",\"F0000009\": \"03ea2021-f7d5-4001-b996-7115e63f4319;6d1af175-a49d-48ad-bc3e-52aa35bb34df;db4d0ace-9a0c-4c57-bc3d-47138856c6a6\"}");

dicParams.Add("BizObjectArray", Chendd.ToArray());

dicParams.Add("IsSubmit", "false");

 

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();

List<String> list = new ArrayList<>();
  list.add("{\"CreatedBy\":   \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",\"OwnerId\": \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",   \"F0000002\": \"123\",\"F0000009\":   \"03ea2021-f7d5-4001-b996-7115e63f4319;6d1af175-a49d-48ad-bc3e-52aa35bb34df;db4d0ace-9a0c-4c57-bc3d-47138856c6a6\"}");
  list.add("{\"CreatedBy\": \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",\"OwnerId\":   \"f3f69a49-edf6-468d-9aee-8cbc82a46662\", \"F0000002\":   \"123\",\"F0000009\":   \"03ea2021-f7d5-4001-b996-7115e63f4319;6d1af175-a49d-48ad-bc3e-52aa35bb34df;db4d0ace-9a0c-4c57-bc3d-47138856c6a6\"}");

paramMap.put("ActionName", "CreateBizObjects");

paramMap.put("SchemaCode", "D000024chuangjian");

paramMap.put("BizObjectArray",list);

paramMap.put("IsSubmit",   "true");  

 

//身份认证参数

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": {

      "BizObjectIdArray": [

        "60561b8e-2296-419a-a647-842ea587941b",

        "cbd49710-4d9f-4b4d-86f9-d24c9c97e5d5"

      ],

      "WorkflowInstanceIdArray": [

        "f628d7dc-b1e5-4e6d-8157-757541fddf37",

        "506c3c4a-4d15-4d91-b4d6-fe4cb837f122"

      ]

    },

    "DataType": 0

}

 

参数

说明

Successful

返回结果是否成功true/false

ErrorMessage

错误信息

Logined

未使用,忽略

ReturnData

返回的数据

DataType

返回的数据类型,默认0