package com.muzhi.dingtalk.test.http;

import java.util.HashMap;
import java.util.Map;

public class Test {
    public static void main(String[] args) throws Exception {

        // Map<String, String> params = new HashMap<>();
        // params.put("ActionName", "CreateBizObject");
        // params.put("SchemaCode", "D0015996667feb3a9584ac199991c38b676fb33");
        // params.put("IsSubmit", "true");
        //
        // String objStr =
        // "{\"CreatedBy\":\"2f2825f6-9325-415e-899e-07dd0cae1ad6\",\"OwnerId\":\"2f2825f6-9325-415e-899e-07dd0cae1ad6\",\"F0000001\":\"123\",\"F0000002\":\"123\"}";
        // params.put("BizObject", objStr);

        String paramsJson = "{" + "    \"ActionName\": \"CreateBizObject\","
            + "    \"SchemaCode\": \"D0015996667feb3a9584ac199991c38b676fb33\","
            + "    \"BizObject\": \"{\\\"CreatedBy\\\": \\\"2f2825f6-9325-415e-899e-07dd0cae1ad6\\\","
            + "        \\\"OwnerId\\\": \\\"2f2825f6-9325-415e-899e-07dd0cae1ad6\\\","
            + "        \\\"F0000001\\\": \\\"123\\\"," + "        \\\"F0000002\\\": \\\"123\\\"" + "    }\","
            + "    \"IsSubmit\": \"true\"" + "}";

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

        HttpUtils httpConn = new HttpUtils();
        String str = httpConn.sendPost("https://www.h3yun.com/OpenApi/Invoke", paramsJson, headers);
        System.out.println(str);
    }

}
