我将在docusign rest api v2(第93页)中的“发送信封或创建草稿信封”后发送签名文档。
文档会被发送和签名,但我遇到了事件通知功能的问题。
我对这个功能的xml结构有点困惑。我尝试了很多不同的组合,但我无法弄清楚。有什么帮助吗?
这是我尝试的众多之一...
<eventNotification>
<url>xxxxxx</url>
<includeDocuments>false</includeDocuments>
<loggingEnabled>true</loggingEnabled>
<envelopeEvents>
<envelopeEvent>
<envelopeEventStatusCode>completed</envelopeEventStatusCode>
</envelopeEvent>
</envelopeEvents>
</eventNotification>
答案 0 :(得分:2)
虽然从技术上讲,DocuSign REST API支持XML格式和JSON格式,但大多数DocuSign REST API文档,代码示例和开发人员资源都使用JSON格式。不幸的是,这意味着尝试将XML格式与DocuSign REST API一起使用(除了执行基本任务之外的任何事情)都会非常令人沮丧 - 因为当您的XML请求无法按预期工作时,您几乎没有资源可以找出正确的格式是。
出于这个原因,我建议您考虑使用JSON而不是XML与DocuSign REST API。这是一个成功创建信封通知的JSON请求。
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
"templateId": "TEMPLATE_ID",
"templateRoles": [
{
"roleName": "Signer1",
"name": "John Doe",
"email": "johnsemail@outlook.com"
}
],
"eventNotification": {
"url": "http://www.google.com",
"loggingEnabled": "true",
"requireAcknowledgement": "true",
"includeDocuments" : "false",
"envelopeEvents" : [{
"envelopeEventStatusCode" : "completed"
}]
},
"status": "sent"
}
更新:使用以下Ergin提供的信息,我能够使用XML实现这一点 - 关键是在 EnvelopeEvents 元素。以下是成功触发Connect通知的请求示例:
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
<envelopeDefinition xmlns="http://www.docusign.com/restapi">
<accountId>ACCOUNT_ID</accountId>
<status>sent</status>
<templateId>TEMPLATE_ID</templateId>
<templateRoles>
<templateRole>
<email>johnsemail@outlook.com</email>
<name>John Doe</name>
<roleName>Signer1</roleName>
</templateRole>
</templateRoles>
<eventNotification>
<EnvelopeEvents>
<envelopeEvent>
<envelopeEventStatusCode>completed</envelopeEventStatusCode>
</envelopeEvent>
</EnvelopeEvents>
<includeDocuments>false</includeDocuments>
<loggingEnabled>true</loggingEnabled>
<requireAcknowledgement>true</requireAcknowledgement>
<url>http://www.google.com</url>
</eventNotification>
</envelopeDefinition>
答案 1 :(得分:2)
Kim是正确的,因为DocuSign目前没有XML格式请求正文的良好文档。但是,由于技术限制,有时JSON不是一个选项,您不希望重新编写解析代码或其他原因,并且开发人员仍然坚持使用XML格式。
话虽如此,这里是 eventNotifications 对象的正确XML格式,以及您可以在其上设置的所有可能属性:
<eventNotification>
<EnvelopeEvents>
<envelopeEvent>
<envelopeEventStatusCode>sample string 1</envelopeEventStatusCode>
<includeDocuments>sample string 2</includeDocuments>
</envelopeEvent>
<envelopeEvent>
<envelopeEventStatusCode>sample string 1</envelopeEventStatusCode>
<includeDocuments>sample string 2</includeDocuments>
</envelopeEvent>
</EnvelopeEvents>
<includeCertificateWithSoap>sample string 6</includeCertificateWithSoap>
<includeDocuments>sample string 8</includeDocuments>
<includeEnvelopeVoidReason>sample string 9</includeEnvelopeVoidReason>
<includeSenderAccountAsCustomField>sample string 11</includeSenderAccountAsCustomField>
<includeTimeZone>sample string 10</includeTimeZone>
<loggingEnabled>sample string 2</loggingEnabled>
<recipientEvents>
<recipientEvent>
<includeDocuments>sample string 2</includeDocuments>
<recipientEventStatusCode>sample string 1</recipientEventStatusCode>
</recipientEvent>
<recipientEvent>
<includeDocuments>sample string 2</includeDocuments>
<recipientEventStatusCode>sample string 1</recipientEventStatusCode>
</recipientEvent>
</recipientEvents>
<requireAcknowledgment>sample string 3</requireAcknowledgment>
<signMessageWithX509Cert>sample string 7</signMessageWithX509Cert>
<soapNameSpace>sample string 5</soapNameSpace>
<url>sample string 1</url>
<useSoapInterface>sample string 4</useSoapInterface>
</eventNotification>