通过DocuSign传递自定义值

时间:2015-06-25 09:36:51

标签: docusignapi

我们正在使用DocuSign的.NET客户端向客户发送合同。我们需要通过提交传递一些元数据。这是我们的合同内部ID。当我们从connect API接收状态更新时,我们使用它来跟踪信封。我知道信封ID,但我们已经做出了设计决定,我们也想要自己的ID。

我尝试使用TextCustomField传递值并在请求中设置它,但是当我们收到状态消息时,自定义字段不存在。是否可以将自定义字段用于此目的,或者是否有更好的方法来传递元数据?

我包括我们请求的其余跟踪,以便有人可以确定我需要更改的内容,以便将值包含在信封状态信息中。

POST: https://demo.docusign.net/restapi/v2/accounts/111111/envelopes?api_password=true

Headers:
X-DocuSign-Authentication:<DocuSignCredentials><Username>****</Username><Password>****</Password><IntegratorKey>****</IntegratorKey></DocuSignCredentials>
Content-Type:multipart/form-data; boundary=00000000-0000-0000-0000-000000000000
Host:demo.docusign.net
Content-Length:1217301
Expect:100-continue
Connection:Keep-Alive

Request Stream:

--00000000-0000-0000-0000-000000000000
Content-Type: application/json
Content-Disposition: form-data

{
    "emailSubject": "Anfrage 2015-06-25T09:10:49: Signieren Sie jetzt Ihren Acme Vertrag",
    "status": "sent",
    "compositeTemplates": [
        {
            "compositeTemplateId": "1",
            "inlineTemplates": [
                {
                    "sequence": "1",
                    "recipients": {
                        "signers": [
                            {
                                "email": "mjones@foo.com",
                                "name": "Max Jones",
                                "recipientId": "1",
                                "routingOrder": "1",
                                "tabs": {
                                    "signHereTabs": [
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeContract1_eSignSignHere",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeSepa1_eSignSignHere",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeBillAndCollect1_eSignSignHere",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeRequest1_eSignSignHere",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeBillAndCollectSepa1_eSignSignHere",
                                            "recipientId": "1"
                                        }
                                    ],
                                    "fullNameTabs": [
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeContract1_eSignFullName",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeSepa1_eSignFullName",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeBillAndCollect1_eSignFullName",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeRequest1_eSignFullName",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeBillAndCollectSepa1_eSignFullName",
                                            "recipientId": "1"
                                        }
                                    ],
                                    "textTabs": [
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        },
                                        {
                                            "shared": false,
                                            "requireInitialOnSharedChange": false,
                                            "requireAll": false,
                                            "locked": false,
                                            "concealValueOnDocument": false,
                                            "disableAutoSize": false,
                                            "templateLocked": false,
                                            "templateRequired": false,
                                            "documentId": 1,
                                            "tabLabel": "Signature_ContractNumber",
                                            "required": true,
                                            "recipientId": "1"
                                        }
                                    ],
                                    "dateSignedTabs": [
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeContract1_eSignDateSigned",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeSepa1_eSignDateSigned",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeBillAndCollect1_eSignDateSigned",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeRequest1_eSignDateSigned",
                                            "recipientId": "1"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_LesseeBillAndCollectSepa1_eSignDateSigned",
                                            "recipientId": "1"
                                        }
                                    ]
                                },
                                "emailNotification": {
                                    "emailBody": "",
                                    "emailSubject": "Anfrage 2015-06-25T09:10:49: Signieren Sie jetzt Ihren Acme Vertrag",
                                    "supportedLanguage": "de"
                                }
                            },
                            {
                                "email": "eContractDevelopment@foo.com",
                                "name": "Any Signer",
                                "recipientId": "3",
                                "routingOrder": "3",
                                "tabs": {
                                    "signHereTabs": [
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_SalesFirstBillAndCollect1_eSignSignHere",
                                            "recipientId": "3"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_SalesFirstContract1_eSignSignHere",
                                            "recipientId": "3"
                                        }
                                    ],
                                    "dateSignedTabs": [
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_SalesFirstBillAndCollect1_eSignDateSigned",
                                            "recipientId": "3"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_SalesFirstContract1_eSignDateSigned",
                                            "recipientId": "3"
                                        }
                                    ]
                                },
                                "emailNotification": {
                                    "emailBody": "",
                                    "emailSubject": "Anfrage 2015-06-25T09:10:49: Signieren Sie jetzt Ihren Acme Vertrag",
                                    "supportedLanguage": "de"
                                }
                            },
                            {
                                "email": "eContractDevelopment@foo.com",
                                "name": "Any Signer",
                                "recipientId": "4",
                                "routingOrder": "4",
                                "tabs": {
                                    "signHereTabs": [
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_SalesSecondBillAndCollect1_eSignSignHere",
                                            "recipientId": "4"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_SalesSecondContract1_eSignSignHere",
                                            "recipientId": "4"
                                        }
                                    ],
                                    "dateSignedTabs": [
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_SalesSecondBillAndCollect1_eSignDateSigned",
                                            "recipientId": "4"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_SalesSecondContract1_eSignDateSigned",
                                            "recipientId": "4"
                                        }
                                    ]
                                },
                                "emailNotification": {
                                    "emailBody": "",
                                    "emailSubject": "Anfrage 2015-06-25T09:10:49: Signieren Sie jetzt Ihren Acme Vertrag",
                                    "supportedLanguage": "de"
                                }
                            },
                            {
                                "email": "mosstest2@foo.com",
                                "name": "A Reseller",
                                "recipientId": "2",
                                "routingOrder": "2",
                                "tabs": {
                                    "signHereTabs": [
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_ResellerContract1_eSignSignHere",
                                            "recipientId": "2"
                                        }
                                    ],
                                    "fullNameTabs": [
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_ResellerContract1_eSignFullName",
                                            "recipientId": "2"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_ResellerBillAndCollect1_eSignFullName",
                                            "recipientId": "2"
                                        }
                                    ],
                                    "dateSignedTabs": [
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_ResellerContract1_eSignDateSigned",
                                            "recipientId": "2"
                                        },
                                        {
                                            "documentId": 1,
                                            "tabLabel": "Signature_ResellerBillAndCollect1_eSignDateSigned",
                                            "recipientId": "2"
                                        }
                                    ]
                                },
                                "emailNotification": {
                                    "emailBody": "",
                                    "emailSubject": "Anfrage 2015-06-25T09:10:49: Signieren Sie jetzt Ihren Acme Vertrag",
                                    "supportedLanguage": "de"
                                }
                            }
                        ]
                    }
                }
            ],
            "document": {
                "documentId": "1",
                "name": "Application.pdf",
                "transformPdfFields": "true"
            }
        }
    ],
    "customFields": {
        "textCustomFields": [
            {
                "name": "EContractID",
                "value": "ECID-2015-06-25T09:10:49"
            }
        ]
    }
}

--00000000-0000-0000-0000-000000000000
Content-Type: application/pdf
Content-Disposition: file; filename="Application.pdf"; documentId=1; compositeTemplateId="1"

[file bits go here]

--00000000-0000-0000-0000-000000000000--


Response:
{
  "envelopeId": "afee6152-23ba-4bcb-a4ad-5b8d8c4dfd7b",
  "uri": "/envelopes/afee6152-23ba-4bcb-a4ad-5b8d8c4dfd7b",
  "statusDateTime": "2015-06-25T18:12:44.0430000Z",
  "status": "sent"
}


POST: https://demo.docusign.net/restapi/v2/accounts/1111111/envelopes/afee6152-23ba-4bcb-a4ad-5b8d8c4dfd7b/views/sender.json?api_password=true

Headers:
Accept:application/json
Content-Type:application/json
X-DocuSign-Authentication:<DocuSignCredentials><Username>****</Username><Password>*****</Password><IntegratorKey>****</IntegratorKey></DocuSignCredentials>
Host:demo.docusign.net
Content-Length:16
Expect:100-continue

Request Stream:
{"ReturnUrl":""}


Response:
{
  "url": "https://demo.docusign.net/Member/StartInSession.aspx?StartConsole=1&t=17c4b711-7844-4753-bb2a-fc5251a32deb&DocuEnvelope=afee6152-23ba-4bcb-a4ad-5b8d8c4dfd7b&send=1"
}

2 个答案:

答案 0 :(得分:0)

以下是传递自定义字段的工作示例。看起来您的文档和自定义字段元素需要位于inlineTemplate

{
    "compositeTemplates": [
        {
            "inlineTemplates": [
                {
                    "customFields": {                        
                        "textCustomFields": [
                            {
                                "name": "customEnvId",
                                "value": "123"
                            }
                        ]
                    },
                    "documents": [
                        {
                            "documentId": "1",
                            "name": "Application.txt"
                        }
                    ],
                    "recipients": {
                        "signers": [
                            {
                                "clientUserId": "1",
                                "email": "mjones@foo.com",
                                "name": "Max Jones",
                                "recipientId": "1",
                                "routingOrder": "1",
                                "tabs": {
                                    "signHereTabs": [
                                        {
                                            "documentId": 1,
                                            "recipientId": "1",
                                            "tabLabel": "Signature_LesseeContract1_eSignSignHere",
                                            "xPosition": "100",
                                            "yPosition": "100"
                                        }
                                    ]
                                }
                            }
                        ]
                    },
                    "sequence": "1"
                }
            ]
        }
    ],
    "emailSubject": "Anfrage 2015-06-25T09:10:49: Signieren Sie jetzt Ihren Acme Vertrag",
    "status": "sent"
}

答案 1 :(得分:0)

另请查看此链接。这对于弄清楚事物是如何组装非常有帮助。 https://demo.docusign.net/restapi/help