电子合同API开发文档 v5

创建合同

请求地址:/v5/Contracts/create.json

请求方式:POST

接口版本: 5.2.3

接口描述:

'https接口的范例代码
'源码基于VBS语言,用户可在windows主机环境或asp环境调用,asp环境调用时请注意输出方式
'sdk接口都是以https方式调用,因此,要求你的系统(windows)已经拥有证书,
'我公司采用的证书是国际可信任服务商提供的安全证书,绝大部分系统已经内置如果您的系统出现了证书不可信问题
'此时可能需要您手动导入证书文件cacert.pem,即可使用
'cacert.pem为可信任根证书文件
'参考
'WinHttp TLS1.2 possible
'https://social.msdn.microsoft.com/Forums/en-US/8f2f2599-e913-4557-a897-c11796914eb7/winhttp-tls12-possible?forum=isvvba
'How do you set the SecurityProtocolType to TLS 1.2 for a web service
'https://forum.powerbasic.com/forum/user-to-user-discussions/programming/746809-how-do-you-set-the-securityprotocoltype-to-tls-1-2-for-a-web-service/page2
'WinHttpRequestOption enumeration
'https://msdn.microsoft.com/en-us/library/windows/desktop/aa384108(v=vs.85).aspx
'post请求方式
'url 地址
'param 参数

Function APIStore(url,param)
	on error resume next
	Dim httpRequest
	'Set xmlHttp = CreateObject("Microsoft.XMLHTTP")		'这个的核心是WinHttp.WinHttpRequest.5.1,而且它没有option可以设置
	Set httpRequest = CreateObject("WinHttp.WinHttpRequest.5.1")
	httpRequest.Option(9) = 128		'设置使用协议,128,TSL 1.0;512,TSL 1.1; 2048,TSL 1.2。出自winhttp.h文件
	httpRequest.Open "POST", url, False, "", ""	
	httpRequest.setRequestHeader "CONTENT-TYPE","application/x-www-form-urlencoded"
	httpRequest.Send param
	If err.number <> 0 then 
		Response.Write "error,No:" & err.number & ";Description:" & Err.Description	
	else
		Dim result
		result = httpRequest.ResponseText
		Response.Write "POST返回结果:" & result	'asp应用下输出
	End If
	Set httpRequest = Nothing
End function


'获取内容
Function getContent()
	url="https://api-v2.1dq.com/v5/Contracts/create.json"
    param="easy_id=175592531139104768&file_id=signed-ce5858499044c9b8fbbaa272754c145a-108d9e29-0001&name=项目合同协议&signed_data=175592531139104768, 175592531139104768&attachment=[ { "file_id" : "signed-efb2124360fb5f8b109220e27f99ae35-73ff845c-0006", "file_name" : "附件1" }, { "file_id" : "signed-efb2124360fb5f8b109220e27f99ae35-73ff845c-0006", "file_name" : "附件2" } ]&ca_type=1&channel=api©_custom_user=[
    {
        "sign_role":"甲方",
        "sign_name":"姓名",
        "sign_number":"电话",
        "sign_company":"选填项,公司名",
        "sign_seal_hand":1,
        "sign_seal_tpl":1,
        "sign_class":1
    }
]©_data=&deposit_certificate_type=1&file_end_date=¬ice_signed=&pdf_password=&sign_end_date=&signed_custom_user=[
    {
        "sign_role":"甲方",
        "sign_name":"姓名",
        "sign_number":"电话",
        "sign_company":"选填项,公司名",
        "seal_require":["印章要求"],
        "sign_class":1
    }
]&tpl_data={
    "自定义参数": "需要替换的内容1",
    "自定义参数2": "需要替换的内容2"
}&tpl_id="
	APIStore url,param
End function