简体   繁体   中英

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

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>";

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM