跳转至

查询单条业务数据

功能描述

LoadBizObject 用于加载单个数据,请勿使用该接口循环加载数据。如需批量加载数据,请使用 LoadBizObjects

请求方式

POST(HTTPS)

请求地址

https://www.h3yun.com/OpenApi/Invoke

参数说明

参数 参数类型 必填 说明
ActionName String 调用的方法名,如 LoadBizObject
SchemaCode String 需要查询的表单编码。
BizObjectId String 需要查询的数据 ID,每个表单数据均有唯一的 ObjectId

示例:

{
    "ActionName": "LoadBizObject",
    "SchemaCode": "D000024chuangjian",
    "BizObjectId": "fea0ade0-505d-4ffc-bca0-6cbdf3c302c6"
}

⚠️ 注意
使用该方法读取子表附件时,需将子表 SchemaCodeObjectId 作为参数传入。读取主表单数据时不会返回子表附件信息。

请求示例(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", "LoadBizObject");
dicParams.Add("SchemaCode", "D000024chuangjian");
dicParams.Add("BizObjectId", "fea0ade0-505d-4ffc-bca0-6cbdf3c302c6");
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", "LoadBizObject");
paramMap.put("SchemaCode", "D000024chuangjian");
paramMap.put("BizObjectId", "fea0ade0-505d-4ffc-bca0-6cbdf3c302c6");

// 身份认证参数
Map headers = new HashMap();
headers.put("EngineCode", "");
headers.put("EngineSecret", "");

Gson gson = new Gson();
String result = HttpRequestUtil.sendPost(url, gson.toJson(paramMap), headers);
import com.google.gson.Gson;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;

public class HttpRequestUtil {

    /**
     * 发送 POST 请求(JSON 格式)
     * @param url 请求 URL
     * @param jsonParam JSON 参数
     * @param headers 请求头(键值对)
     * @return 响应结果
     * @throws IOException 网络异常
     */
    public static String sendPost(String url, String jsonParam, Map<String, String> headers) throws IOException {
        // 默认请求头
        if (headers == null) {
            headers = new HashMap<>();
        }
        // 设置默认 Content-Type 为 JSON
        if (!headers.containsKey("Content-Type")) {
            headers.put("Content-Type", "application/json");
        }

        HttpURLConnection connection = null;
        try {
            // 创建连接
            URL requestUrl = new URL(url);
            connection = (HttpURLConnection) requestUrl.openConnection();

            // 设置请求方法和超时时间
            connection.setRequestMethod("POST");
            connection.setConnectTimeout(5000); // 连接超时时间(毫秒)
            connection.setReadTimeout(5000);    // 读取超时时间(毫秒)

            // 设置请求头
            for (Map.Entry<String, String> entry : headers.entrySet()) {
                connection.setRequestProperty(entry.getKey(), entry.getValue());
            }

            // 启用输出和输入
            connection.setDoOutput(true);
            connection.setDoInput(true);

            // 写入 JSON 参数
            try (OutputStream os = connection.getOutputStream()) {
                byte[] input = jsonParam.getBytes(StandardCharsets.UTF_8);
                os.write(input, 0, input.length);
            }

            // 获取响应
            int responseCode = connection.getResponseCode();
            if (responseCode == HttpURLConnection.HTTP_OK) {
                try (BufferedReader br = new BufferedReader(
                    new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
                    return br.lines().collect(Collectors.joining(System.lineSeparator()));
                }
            } else {
                try (BufferedReader br = new BufferedReader(
                    new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8))) {
                    String errorResponse = br.lines().collect(Collectors.joining(System.lineSeparator()));
                    throw new IOException("HTTP error code: " + responseCode + ", Response: " + errorResponse);
                }
            }
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }
    }

    // 示例调用
    public static void main(String[] args) {
        try {
            String url = "https://infrastructure.h3yun.com/OpenApi/Invoke";
            Map<String, Object> paramMap = new HashMap<>();
            paramMap.put("ActionName", "CreateBizObject");
            paramMap.put("SchemaCode", "D000183140db733c569465d8205e79b37b8805d");
            paramMap.put("BizObject","{\"CreatedBy\": \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",\"OwnerId\": \"f3f69a49-edf6-468d-9aee-8cbc82a46662\",\"F0000001\": \"123\",\"F0000002\": \"2025-07-09\"}");

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

        Map<String, String> headers = new HashMap<>();
            headers.put("EngineCode", "mi4x54jcr54b0p8hwoad4wxo3");
            headers.put("EngineSecret", "xxxxxxx");

            String jsonParam = new Gson().toJson(paramMap);
            String result = sendPost(url, jsonParam, headers);
            System.out.println("Response: " + result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

返回结果

参数 说明
Successful 返回结果是否成功(true/false)。
ErrorMessage 错误信息,当 `

返回结果示例:

{
    "Successful": true,
    "ErrorMessage": null,
    "Logined": false,
    "ReturnData": {
        "BizObject": {
            "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": "123",
            "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部门"
            }
        }
    },
    "DataType": 0
}

⚠️ 注意

人员/部门字段会返回两个字段,原字段会返回姓名/部门名称,同时会衍生一个{字段编码}Object字段,衍生字段是一个对象,包含氚云的用户/部门Id和姓名/部门名称。

以拥有者为例:

"OwnerId": "System",

"OwnerIdObject": {

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

            "Name": "System"

        },