2013-10-29 28 views
1

我送一個文件簽字下面的「發送信封或創建一個信封草案」中的DocuSign REST API V2,第93頁。項目通知XML結構

該文件被髮送和簽署,但我遇到事件通知功能問題。

我對這個功能的xml結構有點困惑。我嘗試了很多不同的組合,但我無法弄清楚。任何幫助?

這是我試過的許多之一...

<eventNotification> 
    <url>xxxxxx</url> 
    <includeDocuments>false</includeDocuments> 
    <loggingEnabled>true</loggingEnabled> 
    <envelopeEvents> 
     <envelopeEvent> 
      <envelopeEventStatusCode>completed</envelopeEventStatusCode> 
     </envelopeEvent> 
    </envelopeEvents> 
</eventNotification> 
+0

當你說你不能弄清楚,這是否意味着你得到一個錯誤?如果是這樣,它說什麼? – Ergin

+0

對不起,我離開了一個星期,剛回來!我沒有收到錯誤,但是docusign只是不發送消息。你的XML格式與我的幾乎相同,但我會匹配大寫字母,看看它是否有所作爲 –

回答

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> 
+0

謝謝,埃爾金!似乎讓這個工作起作用的關鍵是對EnvelopeEvents元素使用適當的「案例」 - 即將「Envelope」和「Events」都大寫。如果使用「envelopeEvents」(小寫'信封'和'大寫'事件),則不起作用。與一般的DocuSign REST API元素的命名不一致(通常以小寫字母開頭),但很高興知道它是如何工作的。我會更新之前的響應,以包含成功觸發連接通知的XML請求。 –

2

儘管從技術上來講,的DocuSign REST API支持XML格式和JSON格式,大多數的DocuSign REST API文檔,代碼樣本,並且開發人員資源使用JSON。不幸的是,這意味着嘗試在DocuSign REST API中使用XML格式(以執行超出基本任務的任何內容)可能非常令人沮喪 - 因爲當您的XML請求無法按預期工作時,您幾乎沒有資源來弄清楚什麼正確的格式是

因此,我建議您考慮在DocuSign REST API中使用JSON而不是XML。以下是成功爲信封創建通知的JSON請求。

POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes 
{ 
    "templateId": "TEMPLATE_ID", 
    "templateRoles": [ 
    { 
     "roleName": "Signer1", 
     "name": "John Doe", 
     "email": "[email protected]" 
    } 
    ], 
    "eventNotification":  { 
    "url": "http://www.google.com", 
    "loggingEnabled": "true", 
    "requireAcknowledgement": "true", 
    "includeDocuments" : "false", 
    "envelopeEvents" : [{ 
     "envelopeEventStatusCode" : "completed"  
    }] 
    }, 
    "status": "sent" 
} 

UPDATE:使用下面埃爾金提供的信息,我能得到這個使用XML工作 - 關鍵是要使用大寫在EnvelopeEvents兩個「信封」和「事件」元件。下面是一個成功觸發連接通知的請求示例:

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>[email protected]</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> 
+0

我不想在代碼中使用json和xml,並且我不想轉換我所有的XML代碼json。我將等待看看是否有人知道答案。我明白json有更多的例子,但我認爲他們需要記錄xml結構。所有他們的java api演練使用xml ... –

+0

是的,AFAIK「演練」的例子是唯一的地方,你會發現與REST API的XML格式的例子。不幸的是,演練只說明瞭非常基本的場景,並且在請求中使用了最少的參數(元素)。完全同意DocuSign通過REST實際記錄XML的完整請求/響應結構是非常好的。祝你好運! –