Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
495 views
in Technique[技术] by (71.8m points)

java - 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>";
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 protected]</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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...