生成合同签署令牌
请求地址
/v2/contract/miniappexchange
请求方法
POST
请求格式
application/json;charset=UTF-8
请求参数
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
contractId | String | 否 | 合同ID,合同ID和业务ID不能同时为空 |
bizId | String | 否 | 业务ID,合同ID和业务ID不能同时为空 |
tenantName | String | 否 | 子公司名称,若使用业务ID获取签署令牌,且合同是以子公司身份创建的,则需要传递该值,用于确定合同主体 |
user | User | 是 | 签署人信息 |
hidePasswordSettings | Boolean | 否 | 【是否隐藏密码设置弹窗】发起方节点签署时,无密码用户使用验证码签署后是否隐藏自动弹出的密码设置弹窗。 默认false,弹出弹窗,传值为true时,隐藏密码设置弹窗不弹出 |
User(个人用户):
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
contact | String | 是 | 联系方式 |
contactType | String | 是 | 联系类型:MOBILE(手机号), EMAIL(邮箱),EMPLOYEEID(员工ID),NUMBER(员工编号) |
返回参数
参数 | 类型 | 描述 |
---|---|---|
code | Integer | 响应码 |
message | String | 响应消息 |
result | Result | 签署令牌信息 |
Result(签署令牌信息):
参数 | 类型 | 描述 |
---|---|---|
ticket | String | 令牌内容 |
响应码
(全局响应码请查看文档末“全局响应码”):
响应码 | 描述 |
---|---|
1110 | NO VIEW PERMISSION,没有查看权限; 用户没有权限查看合同。 |
请求示例
Http示例
POST /v2/contract/miniappexchange HTTP/1.1
Host: [host]
x-qys-open-timestamp: [替换为请求头生成的TimeStamp]
x-qys-open-signature: [替换为请求头生成的Signature]
x-qys-open-accesstoken: [替换为请求头生成的Token]
Content-Type: application/json
{
"contractId": "2591540368898105360",
"bizId": null,
"user": {
"contact": "10100000000",
"contactType": "MOBILE"
}
}
Java示例
// 初始化sdkClient
String serverUrl = "https://openapi.qiyuesuo.cn";
String accessKey = "替换为您申请的开放平台App Token";
String accessSecret = "替换为您申请的开放平台App Secret";
SdkClient sdkClient = new SdkClient(serverUrl, accessKey, accessSecret);
ContractMiniappTicketRequest request = new ContractMiniappTicketRequest(2591540368898105360L, new User("10100000000", "MOBILE"));
String response = null;
try {
response = sdkClient.service(request);
} catch (Exception e) {
throw new BaseSdkException("调用接口错误,错误原因:" + e.getMessage());
}
SdkResponse<MiniappTicketResult> result = JSONUtils.toQysResponse(response, MiniappTicketResult.class);
if (!result.getCode().equals(0)) {
throw new BaseSdkException("获取合同签署Ticket失败,失败原因:" + result.getCode() + "," + result.getMessage());
}
logger.info("获取合同签署Ticket成功,Ticket:" + result.getResult().getTicket());
C#示例
// 初始化sdkClient
string serverUrl = "https://openapi.qiyuesuo.cn";
string accessKey = "替换为您申请的开放平台App Token";
string accessSecret = "替换为您申请的开放平台App Secret";
SDKClient client = new SDKClient(accessKey, accessSecret, serverUrl);
ContractMiniappTicketRequest request = new ContractMiniappTicketRequest("2591540368898105360", new User("10100000000", "MOBILE"));
string response = null;
try
{
response = client.Service(request);
}
catch(Exception e)
{
throw new Exception("访问接口失败,失败原因:" + e.Message);
}
SdkResponse<MiniappTicketResult> responseObject = HttpJsonConvert.DeserializeResponse<MiniappTicketResult>(response);
if (!responseObject.Code.Equals(0))
{
Console.WriteLine("获取合同签署Ticket失败,失败原因:" + responseObject.Code + "," + responseObject.Message);
}
else
{
Console.WriteLine("获取合同签署Ticket成功,ticket:" + responseObject.Result.Ticket);
}
PHP示例
// 初始化$sdkClient
class Util {
const url = "https://openapi.qiyuesuo.me";
const accessKey = "替换为您申请的开放平台App Token";
const accessSecret = "替换为您申请的开放平台App Secret";
}
$sdkClient = Util::getSDk();
$user = new User();
$user->setName('胡*坤');
$user->setContact('151****6497');
$user->setContactType('MOBILE');
$baseRequest = new ContractMiniappTicketRequest();
$baseRequest->setContractId(2783634589202207116);
$baseRequest->setUser($user);
$result = $sdkClient->service($baseRequest);
print_r($result);
return $result;
Python示例
# 初始化SdkClient
url = "https://openapi.qiyuesuo.cn"
accessToken = '替换为您申请的开放平台App Token'
accessSecret = '替换为您申请的开放平台App Secret'
sdkClient = SdkClient(url, accessToken, accessSecret)
request = ContractMiniappTicketRequest()
request.set_contractId(2784716152783597647)
user = User()
user.set_contact("151****6497")
user.set_contactType("MOBILE")
request.set_user(user)
response = sdkClient.request(request)
print(str(response))