最近在做一个合同电子签章功能,在这里记录下对接的相关信息和实现方式
#region 公共信息 获取token
string appid = APPID;
string reqUrl = SERVERURL;
string appSecret = APPSECRET;
OpenApiClient client = new OpenApiClient(appid, appSecret, reqUrl);//OPENAPI公共客户端
#endregion
#region 各个模块调用示例请求体
#region 获取个人凭证Token
string accessToken = string.Empty;
var tokenRes = client.GetTokenFromServer();
if (tokenRes.code == "100000" && tokenRes.data.accessToken != null)
{
accessToken = tokenRes.data.accessToken;
}
#endregion
//获取文件上传地址
GetLocalUploadFileUrlReq getLocalUploadFileUrlReq = new GetLocalUploadFileUrlReq()
{
fileType = "doc"
};
//PUT上传本地文件
var result = client.GetHttpResponse(getLocalUploadFileUrlReq, accessToken);//获取本地上传文件地址
//var filePath = "D:\\服件\\21电缆\\合理\\电章管理\\test.pdf";
var resp = client.PutLocalfileUpload(result.data.uploadUrl, filePath);//开始put本地文件,返回200文件上传成功
//文件处理
FddUploadFiles uploadFile1 = new FddUploadFiles()
{
fileType = "doc",
fileName = "test.pdf",
fddFileUrl = result.data.fddFileUrl
};
FileProcessReq fileProcessReq = new FileProcessReq()
{
fddFileUrlList = new FddUploadFiles[] { uploadFile1 }
};
var result1 = client.GetHttpResponse(fileProcessReq, accessToken);
推荐阅读