0

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>";
Ergin
  • 9,254
  • 1
  • 19
  • 28
user2573754
  • 21
  • 1
  • 6

1 Answers1

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>
Ergin
  • 9,254
  • 1
  • 19
  • 28
  • do you know why setting tabs in the xml doesn't automatically populate with the values I provide. I have updated the information in the original post. – user2573754 Jul 18 '13 at 20:15
  • I still don't see the closing "" tag? – Ergin Jul 19 '13 at 17:21
  • A couple of other things- first off, I don't see the singular "" "" tags in your updated request body. Next, are you positive that the roleName of "Student" is correct, and that the tabLabel of "StudentId" is also correct? These are set in the template in the Console and need to match.. – Ergin Jul 19 '13 at 17:44
  • I double checked the role name and tabLabel and they match in the xml and on the console. The xml post is successful, but the text in StudentID still hasn't changed. – user2573754 Jul 22 '13 at 16:03
  • Ok, how about my other comments, concerning the singular elements? Can you confirm you have those please... – Ergin Jul 22 '13 at 17:35
  • yes I can confirm I have and the end of envelope definition. I have update the xml in the original post. – user2573754 Jul 22 '13 at 19:36