Reputation: 7
Good day! I am trying to create envelope and send , but occurs an error
UNABLE_TO_LOAD_DOCUMENT
The document is a simple html
<!doctype html><html><head></head><body>test</body></html>
converted to base64.
Here is a request and response to docusign REST api. How can I resolve this issue?
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": "[email protected]","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
}
Upvotes: 0
Views: 222
Reputation: 6818
There are two issues in your request, the document which you are sending is an HTML type so you need to specify fileExtension
attribute inside documents
node. fileExtension
is not required if you are sending any pdf document type, for all other document types you need to specify the document type or extension in fileExtension
attribute. Second issue is you are not defining any DocuSign tabs for the recipient. On a document where you want signers to do something on the document either to Sign or enter any data, for that you need to add any DS Tabs on the document either by X/Y position
or Anchor String
or using DS Server Templates
.
You correct sample example would like below, and it should run perfectly:
{
"status": "sent",
"emailSubject": "test subject",
"documents": [{
"documentId": "1",
"name": "test.html",
"documentBase64": "PCFkb2N0eXBlIGh0bWw+PGh0bWw+PGhlYWQ+PC9oZWFkPjxib2R5PnRlc3Q8L2JvZHk+PC9odG1sPg==",
"fileExtension": "html"
}],
"recipients": {
"signers": [{
"name": "Test Name",
"email": "[email protected]",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"signHereTabs": [{
"documentId": "1",
"pageNumber": "1",
"recipientId": "1",
"xPosition": "500",
"yPosition": "500"
}]
}
}]
}
}
Upvotes: 1