添加CompositeTemplateId会导致错误

时间:2014-08-13 20:52:19

标签: docusignapi

添加compositeTemplateId,如下面的JSON,会导致以下错误:

{
  errorCode: "ENVELOPE_IS_INCOMPLETE"
  message: "The Envelope is not Complete. A Complete Envelope Requires Documents, Recipients, Tabs, and a Subject Line."
}

删除compositeTemplateId可以防止错误,但出于其他原因我需要复合模板ID。

{
    "emailSubject": "Please Print, Complete and Sign Document",
    "emailBlurb": "Please print and complete documents and sign on paper. ",
    "status": "sent",
    "compositeTemplates": [{
        "compositeTemplateId": "1",
        "inlineTemplates": [{
            "sequence": "1",        
            "customFields": {
                "textCustomFields": [{
                    "name": "MyOwnField",
                    "required": "true",
                    "show": "true",
                    "value": "MyValue"
                }]
            },
            "recipients": {
                "signers": [{
                    "requireSignOnPaper": "true",
                    "name": "Millard Fillmore",
                    "email": "dgilbert@firstallied.com",
                    "recipientId": "1",
                    "routingOrder": "1"
                }]
            }
        }],
        "document": {
            "documentId": "1",
            "name": "Corestone Account Application.pdf",
            "transformPdfFields": false
        }
    }]
}

1 个答案:

答案 0 :(得分:1)

正如here所述,如果您在API请求的JSON部分中指定 compositeTemplateId 值,那么“ Content-Disposition ”值将为请求中的相应文档部分还必须为 compositeTemplateId 指定相同的值。

如果您在请求的JSON部分中指定 compositeTemplateId ,但 NOT 指定 compositeTemplateId 请求中相应文档部分的 Content-Disposition ,您将收到一条错误消息,指出信封不完整 - 因为DocuSign无法使用 compositeTemplateId 在JSON中指定的值。因此,我怀疑您的问题是由于您目前没有在文档部分的内容处置中指定 compositeTemplateId 这一事实引起的。请求。

以下请求显示了多部分“创建信封”API请求的示例,该请求在两者中指定了相同的 compositeTemplateId 值:

  • inlineTemplate 对象(在邮件的JSON部分内)

  • Content-Disposition 值(在邮件的文档部分内)

示例请求

POST https://demo.docusign.net/restapi/v2/accounts/201105/envelopes HTTP/1.1

X-DocuSign-Authentication: {"Username":"johnDoe@gmail.com","Password":"johnsPassword!","IntegratorKey":"ABCD-eae5f282-j4k3-47c3-b293-1c4cf55b-93gh"}
Content-Type: multipart/form-data; boundary=MY_BOUNDARY
Accept: application/json

--MY_BOUNDARY
Content-Type: application/json
Content-Disposition: form-data

{
    "emailBlurb":"Test Email Body",
    "emailSubject": "Test Email Subject",
    "status" : "sent",
    "compositeTemplates": [
    {
        "compositeTemplateId": 1,
        "inlineTemplates": [
        {
            "sequence" : 1,
            "customFields": {
                "textCustomFields": [
                    {
                        "value": "1234567",
                        "required": "false",
                        "show": "true",
                        "name": "ProductId"
                    }
                ]
            },
            "recipients": {
                "signers" : [{
                    "email": "sallysEmail@outlook.com",
                    "name": "Sally Adamson",
                    "recipientId": "1",
                    "defaultRecipient": "true",
                    "emailNotification": {
                                "emailSubject": "Recipient specific subject",
                                "emailBody": "Recipient specific body"
                    }
                }]
            }
        }],
        "document": {
            "documentId": 1,
            "name": "NDA",
            "transformPdfFields": "true"
        }
    }]
}
--MY_BOUNDARY
Content-Type: application/pdf
Content-Disposition: file; filename="SampleForm.pdf"; compositeTemplateId="1"; documentid="1"

...pdf_byte_stream_here...

--MY_BOUNDARY--