下载合同
1 下载合同与签署日志
请求地址:/v2/contract/download
**请求方法:**GET
请求参数:
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
contractId | String | 否 | 合同ID,合同ID与业务ID二选一,不能同时为空 |
bizId | String | 否 | 业务ID,合同ID与业务ID二选一,不能同时为空 |
tenantName | String | 否 | 子公司名称,若使用业务ID下载合同,且合同是以子公司身份创建的,则需要传递该值,用于确定合同主体 |
返回参数:
合同文件和签署日志的压缩包(.zip)
请求示例:
Http示例
GET /v2/contract/download?contractId=2591540368898105360 HTTP/1.1
Host: [host]
x-qys-open-timestamp: [替换为请求头生成的Timestamp]
x-qys-open-signature: [替换为请求头生成的Signature]
x-qys-open-accesstoken: [替换为请求头生成的Token]
Java示例
// 初始化sdkClient
String serverUrl = "https://openapi.qiyuesuo.cn";
String accessKey = "替换为您申请的开放平台App Token";
String accessSecret = "替换为您申请的开放平台App Secret";
SdkClient sdkClient = new SdkClient(serverUrl, accessKey, accessSecret);
// 下载合同
ContractDownloadRequest request = new ContractDownloadRequest(contractId);
FileOutputStream fos = new FileOutputStream("E:/test/contract.zip");
sdkClient.download(request, fos);
IOUtils.safeClose(fos);
logger.info("下载合同成功");
C#示例
// 初始化sdkClient
string serverUrl = "https://openapi.qiyuesuo.cn";
string accessKey = "替换为您申请的开放平台App Token";
string accessSecret = "替换为您申请的开放平台App Secret";
SDKClient client = new SDKClient(accessKey, accessSecret, serverUrl);
//下载合同
ContractDownloadRequest request = new ContractDownloadRequest();
request.ContractId = "2589012016299597907";
Stream stream = new FileStream("C:\Users\Richard Cheung\Documents\契约锁\合同压缩包.zip", FileMode.Create);
try
{
client.Download(request, ref stream);
}
catch (Exception e)
{
throw new Exception(e.Message);
}
PHP示例
// 初始化$sdkClient
class Util {
const url = "https://openapi.qiyuesuo.cn";
const accessKey = "替换为您申请的开放平台App Token";
const accessSecret = "替换为您申请的开放平台App Secret";
}
$sdkClient = Util::getSDk();
$filePath = "D:/contract-php-test.zip";
$contractDownloadRequest = new ContractDownloadRequest();
$contractDownloadRequest->setContractId('2590804900506210559');
$contractDownloadRequest->setBizId('123456789');
$result = $sdkClient->downloadService($contractDownloadRequest, $filePath);
print_r($result);
Python示例
# 初始化SdkClient
url = "https://openapi.qiyuesuo.cn"
accessToken = '替换为您申请的开放平台App Token'
accessSecret = '替换为您申请的开放平台App Secret'
sdkClient = SdkClient(url, accessToken, accessSecret)
# 下载所有合同文件
contractdownload_request = ContractDownloadRequest()
contractdownload_request.set_contractId('2589643804158468448')
contract_zip = open("C:\Users\Richard Cheung\Documents\契约锁\合同文档.zip", "wb")
contract_zip.write(sdkClient.request(contractdownload_request))
print('下载文件成功 n')
2 下载合同文档
请求地址:/v2/document/download
**请求方法:**GET
请求参数:
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
documentId | String | 是 | 合同文档ID |
返回参数:
合同文件(.pdf)
请求示例:
Http示例
GET /v2/document/download?documentId=2591542337725374704 HTTP/1.1
Host: [host]
x-qys-open-timestamp: [替换为请求头生成的Timestamp]
x-qys-open-signature: [替换为请求头生成的Signature]
x-qys-open-accesstoken: [替换为请求头生成的Token]
Java示例
// 初始化sdkClient
String serverUrl = "https://openapi.qiyuesuo.cn";
String accessKey = "替换为您申请的开放平台App Token";
String accessSecret = "替换为您申请的开放平台App Secret";
SdkClient sdkClient = new SdkClient(serverUrl, accessKey, accessSecret);
// 下载合同文档
DocumentDownloadRequest request = new DocumentDownloadRequest(2586891626797203479L);
FileOutputStream fos = new FileOutputStream("E:/test/doc.pdf");
sdkClient.download(request, fos);
IOUtils.safeClose(fos);
logger.info("下载合同文档成功");
C#示例
// 初始化sdkClient
string serverUrl = "https://openapi.qiyuesuo.cn";
string accessKey = "替换为您申请的开放平台App Token";
string accessSecret = "替换为您申请的开放平台App Secret";
SDKClient client = new SDKClient(accessKey, accessSecret, serverUrl);
//下载合同
string documentId = "2589013696294510740";
DocumentDownloadRequest request = new DocumentDownloadRequest();
request.DocumentId = documentId;
Stream stream = new FileStream("C:\Users\Richard Cheung\Documents\契约锁\document.pdf", FileMode.Create);
try
{
client.Download(request, ref stream);
}
catch (Exception e)
{
throw new Exception(e.Message);
}
PHP示例
// 初始化$sdkClient
class Util {
const url = "https://openapi.qiyuesuo.cn";
const accessKey = "替换为您申请的开放平台App Token";
const accessSecret = "替换为您申请的开放平台App Secret";
}
$sdkClient = Util::getSDk();
$filePath = "D:/php-test.pdf";
$documentDownloadRequest = new DocumentDownloadRequest('2590805031263637783');
$result = $sdkClient->downloadService($documentDownloadRequest, $filePath);
print_r($result);
Python示例
# 初始化SdkClient
url = "https://openapi.qiyuesuo.cn"
accessToken = '替换为您申请的开放平台App Token'
accessSecret = '替换为您申请的开放平台App Secret'
sdkClient = SdkClient(url, accessToken, accessSecret)
# 下载单个文件
documentdownload_request = DocumentDownloadRequest()
documentdownload_request.set_documentId('2589649754185539990')
document_pdf = open("C:\Users\Richard Cheung\Documents\契约锁\py.pdf", "wb")
document_pdf.write(sdkClient.request(documentdownload_request))
print('下载单个文件成功 n')
3 下载合同附件
请求地址:/v2/attachment/download
**请求方法:**GET
请求参数:
参数 | 类型 | 必须 | 描述 |
---|---|---|---|
contractId | String | 否 | 合同ID,合同ID与业务ID二选一,不能同时为空 |
bizId | String | 否 | 业务ID,合同ID与业务ID二选一,不能同时为空 |
tenantName | String | 否 | 子公司名称,若使用业务ID下载合同,且合同是以子公司身份创建的,则需要传递该值,用于确定合同主体 |
返回参数:
合同附件压缩包(.zip)
请求示例:
Http示例
GET /v2/attachment/download?contractId=2591540368898105360 HTTP/1.1
Host: [host]
x-qys-open-timestamp: [替换为请求头生成的Timestamp]
x-qys-open-signature: [替换为请求头生成的Signature]
x-qys-open-accesstoken: [替换为请求头生成的Token]
Java示例
// 初始化sdkClient
String serverUrl = "https://openapi.qiyuesuo.cn";
String accessKey = "替换为您申请的开放平台App Token";
String accessSecret = "替换为您申请的开放平台App Secret";
SdkClient sdkClient = new SdkClient(serverUrl, accessKey, accessSecret);
// 下载合同附件
AttachmentDownloadRequest request = new AttachmentDownloadRequest(contractId);
FileOutputStream fos = new FileOutputStream("E:/test/attachment.pdf");
sdkClient.download(request, fos);
IOUtils.safeClose(fos);
logger.info("下载附件成功");
C#示例
// 初始化sdkClient
string serverUrl = "https://openapi.qiyuesuo.cn";
string accessKey = "替换为您申请的开放平台App Token";
string accessSecret = "替换为您申请的开放平台App Secret";
SDKClient client = new SDKClient(accessKey, accessSecret, serverUrl);
//下载附件
AttachmentDownloadRequest request = new AttachmentDownloadRequest();
request.ContractId = "2589012016299597907";
Stream stream = new FileStream("C:\Users\Richard Cheung\Documents\契约锁\attachment.zip", FileMode.Create);
try
{
client.Download(request, ref stream);
}
catch (Exception e)
{
throw new Exception(e.Message);
}
PHP示例
// 初始化$sdkClient
class Util {
const url = "https://openapi.qiyuesuo.cn";
const accessKey = "替换为您申请的开放平台App Token";
const accessSecret = "替换为您申请的开放平台App Secret";
}
$sdkClient = Util::getSDk();
$filePath = "D:/attachment-php-test.zip";
$attachmentDownloadRequest = new AttachmentDownloadRequest();
$attachmentDownloadRequest->setContractId('2590804900506210559');
$attachmentDownloadRequest->setBizId('123456789');
$result = $sdkClient->downloadService($attachmentDownloadRequest, $filePath);
print_r($result);
Python示例
# 初始化SdkClient
url = "https://openapi.qiyuesuo.cn"
accessToken = '替换为您申请的开放平台App Token'
accessSecret = '替换为您申请的开放平台App Secret'
sdkClient = SdkClient(url, accessToken, accessSecret)
# 下载附件信息
attachmentdownload_request = AttachmentDownloadRequest()
attachmentdownload_request.set_contractId('2589643804158468448')
attachment_zip = open("C:\Users\Richard Cheung\Documents\契约锁\attachment.zip", "wb")
attachment_zip.write(sdkClient.request(attachmentdownload_request))
print('附件下载成功 n')