How to pre-fill tabs on a server template with the DocuSign API

懵懂的女人 提交于 2020-01-09 12:10:19

问题


Is it possible to fill in a tab on a server template? If so what would be the correct XML format to do that? I have tried the suggested solution from the post on the DocuSign forum, that solution did not work. I have read the documentation but it is unclear what the format should be and I can't seem to find any examples. This is what I have now and it is not working it returns and error 400: The XML request does not match the expected format. Does anyone know for sure the correct format?

* * Update **** I used a JSON to XML converter to get the correct xml format. The following is accepted by the server but does not update the server template.

String requestBody = "<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
    "<accountId>" + accountId + "</accountId>" +
    "<status>sent</status>" +
    "<emailSubject>" + emailSubject + "</emailSubject>" +
    "<emailBlurb>" + emailBlurb + "</emailBlurb>" +
    "<templateId>81bcad0d-91ed-4616-****-************</templateId>" +
    "<templateRoles>" +
       "<templateRole>" +
          "<email>" + emailaddr4[0] + "</email>" +
          "<name>" + names[0] + "</name>" + 
          "<roleName>Student</roleName>" +
          "<tabs>" +
             "<textTabs>" +
                "<textTab>" +
                     "<tabLabel>StudentID</tabLabel>" +
                     "<value>" + student_id + "</value>" +
                     "<documentId>1</documentId>" +
                     "<pageNumber>1</pageNumber>" +
                "</textTab>"
              "</textTabs>" +
           "</tabs>" + 
     "</templateRole>" +
  "</templateRoles>" + 
"</envelopeDefinition>";

回答1:


Sorry, I could have sworn that the singular textTab was needed inside of the textTabs element, but it looks like this supposed to be named just text instead. Here is a full XML request body that works

<envelopeDefinition xmlns="http://www.docusign.com/restapi">
   <accountId>221765</accountId>
   <status>sent</status>
   <emailSubject>API Call for sending signature request from template</emailSubject>
   <emailBlurb>This comes from Java</emailBlurb>
   <templateId>DD92AF6F-3B87-435C-A652-A7451AFE758E</templateId>
   <templateRoles>
      <templateRole>
         <email>email@docusign.com</email>
         <name>John Doe</name>
         <roleName>Signer1</roleName>
         <tabs>
            <textTabs>
               <text>
                  <tabLabel>DataField1</tabLabel>
                  <value>Initial Data Goes Here</value>
               </text>
            </textTabs>
         </tabs>
      </templateRole>
   </templateRoles>
</envelopeDefinition>


来源:https://stackoverflow.com/questions/17600349/how-to-pre-fill-tabs-on-a-server-template-with-the-docusign-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!