Docusign,无法创建简单的信封

时间:2018-06-06 13:12:27

标签: docusignapi

美好的一天! 我正在尝试创建信封并发送,但发生错误

  

UNABLE_TO_LOAD_DOCUMENT

该文件是一个简单的html

<!doctype html><html><head></head><body>test</body></html>

转换为base64。

这是对docusign REST api的请求和响应。我该如何解决这个问题?

curl -v --header "Authorization: Bearer eyJ0eXAiOiJNVCIsImFsZyI6IlJTMjU2Iiwia2lkIjoiNjgxODVmZjEtNGU1MS00Y2U5LWFmMWMtNjg5ODEyMjAzMzE3In0.AQkAAAABAAUABwAACRsipsvVSAgAAEk-MOnL1UgCAN1TkZsZHQBNmEVScLwqs5wVAAEAAAAYAAEAAAAFAAAADQAkAAAANzVmYmZkZGUtNTBkOC00NTU0LTg0NGEtOTBhMmNlNDc1YWU4EgABAAAACwAAAGludGVyYWN0aXZlMAAA3OkgpsvVSA.2hzUVkqJjMOlL9UviE-oCeGyvIG84bBH0czLFwK6M4sO1NnzstvE8__6lmdyRqoZTIk879xQmm6e1YEzlDVxI5iKL7lE1b4I63BhHHPhtAk5gD6pWch3blPhM5rrGlJnf9DAZ6zAsR5Ku6IuFXaGwm7ZxvTe30qd76RJEReJoqwed_f-hT9VTFmipBZt5336ewkGgGHJp2fKNpyg-ImYCkuNGpnhiMGwDT2z92-YFQ7h26laKZGwE_4pFO3ihH9I4y7-R2pBsF2vWXq7yQeS6497oQftdjFEaUdcZvciN8Gen-EeGo1HG8kD2xPEtrlDWcrhXE3dlcuS5YyQu21TzQ" \
> --header "Content-Type: application/json" \
> --data '{"status": "sent","emailSubject": "test subject","documents": [{"documentId": "1","name": "test.html","documentBase64": "PCFkb2N0eXBlIGh0bWw+PGh0bWw+PGhlYWQ+PC9oZWFkPjxib2R5PnRlc3Q8L2JvZHk+PC9odG1sPg=="}],"recipients": {"signers": [{"name": "Test Name","email": "test@perlito.ru","recipientId": "1","routingOrder": "1"}]}}' \
> --request POST https://demo.docusign.net/restapi/v2/accounts/8392ced0-e907-4569-802f-73a31cf08696/envelopes
* Hostname was NOT found in DNS cache
*   Trying 162.248.186.25...
* Connected to demo.docusign.net (162.248.186.25) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-AES256-GCM-SHA384
* Server certificate:
*    subject: 1.3.6.1.4.1.311.60.2.1.3=US; 1.3.6.1.4.1.311.60.2.1.2=Delaware; businessCategory=Private Organization; serialNumber=5711317; C=US; postalCode=98101; ST=Washington; L=Seattle; street=1301 2nd Ave, Suite 2000; O=DocuSign, Inc.; OU=Technical Operations; CN=demo.docusign.net
*    start date: 2017-01-09 00:00:00 GMT
*    expire date: 2019-02-23 23:59:59 GMT
*    subjectAltName: demo.docusign.net matched
*    issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 EV SSL CA - G3
*    SSL certificate verify ok.
> POST /restapi/v2/accounts/8392ced0-e907-4569-802f-73a31cf08696/envelopes HTTP/1.1
> User-Agent: curl/7.35.0
> Host: demo.docusign.net
> Accept: */*
> Authorization: Bearer eyJ0eXAiOiJNVCIsImFsZyI6IlJTMjU2Iiwia2lkIjoiNjgxODVmZjEtNGU1MS00Y2U5LWFmMWMtNjg5ODEyMjAzMzE3In0.AQkAAAABAAUABwAACRsipsvVSAgAAEk-MOnL1UgCAN1TkZsZHQBNmEVScLwqs5wVAAEAAAAYAAEAAAAFAAAADQAkAAAANzVmYmZkZGUtNTBkOC00NTU0LTg0NGEtOTBhMmNlNDc1YWU4EgABAAAACwAAAGludGVyYWN0aXZlMAAA3OkgpsvVSA.2hzUVkqJjMOlL9UviE-oCeGyvIG84bBH0czLFwK6M4sO1NnzstvE8__6lmdyRqoZTIk879xQmm6e1YEzlDVxI5iKL7lE1b4I63BhHHPhtAk5gD6pWch3blPhM5rrGlJnf9DAZ6zAsR5Ku6IuFXaGwm7ZxvTe30qd76RJEReJoqwed_f-hT9VTFmipBZt5336ewkGgGHJp2fKNpyg-ImYCkuNGpnhiMGwDT2z92-YFQ7h26laKZGwE_4pFO3ihH9I4y7-R2pBsF2vWXq7yQeS6497oQftdjFEaUdcZvciN8Gen-EeGo1HG8kD2xPEtrlDWcrhXE3dlcuS5YyQu21TzQ
> Content-Type: application/json
> Content-Length: 322
> 
* upload completely sent off: 322 out of 322 bytes
< HTTP/1.1 400 Bad Request
< Cache-Control: no-cache
< Content-Length: 180
< Content-Type: application/json; charset=utf-8
< X-RateLimit-Reset: 1528290000
< X-RateLimit-Limit: 1000
< X-RateLimit-Remaining: 995
< X-DocuSign-TraceToken: 81b52b47-4b2a-4b56-b1fe-9ec3dfb90b5a
< Date: Wed, 06 Jun 2018 12:59:10 GMT
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< 
{
  "errorCode": "UNABLE_TO_LOAD_DOCUMENT",
  "message": "Unable to load the document. Unable to load Document(1;test.html). Error: the document is corrupt, rebuilding failed"
* Connection #0 to host demo.docusign.net left intact
}

1 个答案:

答案 0 :(得分:1)

您的请求中存在两个问题,您发送的文档是HTML类型,因此您需要在fileExtension节点内指定documents属性。如果要发送任何pdf文档类型,则不需要fileExtension,对于在fileExtension属性中指定文档类型或扩展名所需的所有其他文档类型。第二个问题是您没有为收件人定义任何DocuSign标签。在您希望签名者对文档执行某些操作的文档中,要么签名或输入任何数据,您需要通过X/Y positionAnchor String或使用{{}在文档上添加任何DS标签1}}。

您正确的示例示例如下所示,它应该完美运行:

DS Server Templates