I'm currently sending my signature request call in XML and have referred to the REST API guide as well as the example in Rules for Composite Template Usage and although I was able to successfully pull in the additional server templates in the appropriate sequence, the secure tabs in these templates were not editable; the only template that exposed these was the 'primary' template (not included in the composite templates object). From page 104 in the API guide it appears that the essence of inline templates is to augment the server templates declared (add documents, etc.). Here is my XML sample:
<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">
<accountId>#####</accountId>
<status>sent</status>
<emailSubject>testing 11/18 -3</emailSubject>
<emailBlurb>Email Blurb</emailBlurb>
<templateId>TEMPLATE ID 1</templateId>
<templateRoles>
<templateRole>
<email>insured@email.com</email>
<name>Insured Test</name>
<roleName>Signer</roleName>
</templateRole>
<templateRole>
<email>test@email.com</email>
<name>Test Agent</name>
<roleName>Agent</roleName>
</templateRole>
</templateRoles>
<compositeTemplates>
<compositeTemplate>
<serverTemplates>
<serverTemplate>
<sequence>1</sequence>
<templateId>TEMPLATE ID 2</templateId>
</serverTemplate>
</serverTemplates>
</compositeTemplate>
<compositeTemplate>
<serverTemplates>
<serverTemplate>
<sequence>2</sequence>
<templateId>TEMPLATE ID 3</templateId>
</serverTemplate>
</serverTemplates>
</compositeTemplate>
<compositeTemplate>
<serverTemplates>
<serverTemplate><sequence>3</sequence>
<templateId>TEMPLATE ID 4</templateId>
</serverTemplate></serverTemplates>
</compositeTemplate>
</compositeTemplates>
</envelopeDefinition>
Basically I need to be able to append server templates based upon parameters selected by the user to the primary.
EDIT: I'm assuming that I'd need to pass in template roles for each of the subsequent ID's, but the only place to pass that in would be an inline---which doesn't appear to be applicable for this use case.
EDIT2: Here's my request body with the updates. This time I'm getting INCOMPLETE_ENVELOPE.. I ran this against the API Explorer and for some reason when I added in the original top-level template ID and respective roles, I didn't get an error. When sending the updated XML I was able to create the envelope but the added composite templates weren't editable..
<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">
<accountId>1232456</accountId>
<status>sent</status>
<emailSubject>testing inline 11/18 -5</emailSubject>
<emailBlurb>This comes from me</emailBlurb>
<compositeTemplates>
<compositeTemplate>
<serverTemplates>
<serverTemplate>
<sequence>1</sequence>
<templateId>894ed334-4183-4b68-857e-01fe4829f79e</templateId>
</serverTemplate>
</serverTemplates>
<inlineTemplates>
<inlineTemplate>
<sequence>2</sequence>
<recipients>
<recipient>
<signers>
<signer>
<email>email@email.com</email>
<name>Test insured</name>
<roleName>Signer</roleName>
<recipientId>1</recipientId>
</signer>
<signer>
<email>test@gmail.com</email>
<name>Test Agent</name>
<roleName>Agent</roleName>
<recipientId>2</recipientId>
</signer>
</signers>
</recipient>
</recipients>
</inlineTemplate>
</inlineTemplates>
</compositeTemplate>
<compositeTemplate>
<serverTemplates>
<serverTemplate>
<sequence>3</sequence>
<templateId>d1c43bee-2c6b-4910-89f0-64e3fbcce19a</templateId>
</serverTemplate>
</serverTemplates>
<inlineTemplates>
<inlineTemplate>
<sequence>4</sequence>
<recipients>
<recipient>
<signers>
<signer>
<email>email@email.com</email>
<name>Test insured</name>
<roleName>Signer</roleName>
<recipientId>1</recipientId>
</signer>
<signer>
<email>test@gmail.com</email>
<name>Test Agent</name>
<roleName>Agent</roleName>
<recipientId>2</recipientId>
</signer>
</signers>
</recipient>
</recipients>
</inlineTemplate>
</inlineTemplates>
</compositeTemplate>
</compositeTemplates>
</envelopeDefinition>
First, I'm not sure that it's possible to use Composite Templates and also specify a templateId and templateRoles at the top-level of the request (i.e., outside of the compositeTemplates collection). So, my first suggestion would be to modify your request such that all templates (including your first one) are specified within the compositeTemplates collection.
Next, I suspect that the reason none of the tabs are visible within the documents represented by the templates you're referencing in the compositeTemplates collection is that you're not supplying recipient information for each template. As you mentioned in your 'EDIT', this should be accomplished by using an inlineTemplate within each compositeTemplate item. For example, the following request using an InlineTemplate to supply recipient information for the Signer1 role and the Cc1 role that the Server Template defines.
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
<envelopeDefinition xmlns="http://www.docusign.com/restapi">
<accountId>ACCOUNT_ID</accountId>
<status>sent</status>
<compositeTemplates>
<compositeTemplate>
<serverTemplates>
<serverTemplate>
<sequence>1</sequence>
<templateId>3C9D42D3-3E76-4669-861E-9670415E1AD3</templateId>
</serverTemplate>
</serverTemplates>
<inlineTemplates>
<inlineTemplate>
<sequence>2</sequence>
<recipients>
<signers>
<signer>
<email>johnsemail@outlook.com</email>
<name>John Doe</name>
<recipientId>1</recipientId>
<roleName>Signer1</roleName>
</signer>
</signers>
<carbonCopies>
<carbonCopy>
<email>janesemail@outlook.com</email>
<name>Jane Doe</name>
<recipientId>2</recipientId>
<roleName>Cc1</roleName>
</carbonCopy>
</carbonCopies>
</recipients>
</inlineTemplate>
</inlineTemplates>
</compositeTemplate>
</compositeTemplates>
</envelopeDefinition>
If you update your request to include recipient information for each compositeTemplate item (by using inlineTemplates like I've shown above), I'd suspect that the tabs within the template documents should be assigned to the appropriate recipients (per the information you supply within each inlineTemplate).
RE "EDIT 2":
Regarding the XML you posted in your question under "EDIT 2", remove the recipent tags that I've highlighted here -- doing so should result in a valid request that creates the Envelope using the specified Template(s) and assigns the tags appropriately to the recipients you specify in the request.
来源:https://stackoverflow.com/questions/20056137/docusign-api-composite-templates-unable-to-access-tabs-from-server-templates