I'm trying to add documents to a composite template using the docusign api and the documents aren't loading into the envelope the way I would expect it to. I currently have my code working with a test json where I add documents without using composite templates and it works perfectly. It seems the composite templates skip right over the documents however. Here's how I'm creating it:
{
"emailSubject": "Test Email Subject_FA",
"emailBlurb": "Test Email Body_FA",
"status": "created",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "[email protected]",
"name": "test1",
"recipientId": "1",
"routingOrder": "1",
"roleName": "Client 1"
},
{
"email": "[email protected]",
"name": "test2",
"recipientId": "2",
"routingOrder": "2",
"roleName": "Client 2"
}
],
"documents": [
{
"transformPdfFields": "false",
"name": "test0.pdf",
"documentId": "1"
}
]
}
}
]
},
{
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "[email protected]",
"name": "test1",
"recipientId": "1",
"routingOrder": "1",
"roleName": "Client 1"
},
{
"email": "[email protected]",
"name": "test2",
"recipientId": "2",
"routingOrder": "2",
"roleName": "Client 2"
}
],
"documents": [
{
"transformPdfFields": "false",
"name": "test1.pdf",
"documentId": "2"
}
]
}
}
]
}
]
}
This is a little test I'm doing so I understand this is impractical. But what I'm trying to understand is why this wouldn't add documents to the envelope. The request below does what I'm trying to do above.
{
"emailSubject": "Test Email Subject_FA",
"emailBlurb": "Test Email Body_FA",
"status": "created",
"documents": [
{
"name": "test0.pdf",
"documentId": "1"
},
{
"name": "test1.pdf",
"documentId": "2"
},
{
"name": "test2.pdf",
"documentId": "3"
}
],
"recipients": {
"signers": [
{
"email": "[email protected]",
"name": "test1",
"recipientId": "1",
"clientUserId": "1",
"signerName": "test1",
"defaultRecipient": "true",
"defaultRecipientSpecified": "true",
"routingOrder": "1"
},
{
"email": "[email protected]",
"name": "test2",
"recipientId": "2",
"clientUserId": "2",
"signerName": "test2",
"routingOrder": "2"
}
]
}
}
Does anybody know why my envelope for the composite template won't load the documents?
Thank you in advance!
UPDATE:
Here's my request for the composite template:
--MY_BOUNDARY
Content-Type: application/json
Content-Disposition: form-data
{
"emailSubject": "Test Email Subject_FA",
"emailBlurb": "Test Email Body_FA",
"status" : "created",
"compositeTemplates": [
{
"inlineTemplates": [
{
"sequence": "1",
"recipients":
{
"signers": [
{
"email": "[email protected]",
"name": "test1",
"recipientId": "1"
},
{
"email": "[email protected]",
"name": "test2",
"recipientId": "2"
}
],
"document":
{
"name": "test0",
"documentId": "1",
"fileExtension": "pdf"
}
}
}
]
},
{
"inlineTemplates": [
{
"sequence": "2",
"recipients": {
"signers": [
{
"email": "[email protected]",
"name": "test1",
"recipientId": "1"
},
{
"email": "[email protected]",
"name": "test3",
"recipientId": "2"
}
],
"document":
{
"name": "test1",
"documentId": "2",
"fileExtension": "pdf"
}
}
}
]
}
]
}
--MY_BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename="test0.pdf"; documentid="1"
--MY_BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename="test1.pdf"; documentid="2"
--MY_BOUNDARY--
I've adjusted my document to use name and fileDxtension, so I left out the .pdf extension on the fileName as that seems to be another method of implementing this. I've tried it both ways and had no luck.
See Question&Answers more detail:
os