smth
smth

Reputation: 1

How can I download completed document field data with Docusignapi for all documents

I've yet to find the answer to this question after hours of searching, but I'm using the docusign api to pull information about certain envelopes from our account.

I've used the api example here: http://iodocs.docusign.com/APIWalkthrough/getEnvelopeDocuments

What I'm actually looking to do is download the field data within each of the completed documents.

Any guidance on how I could download the field data from all completed documents would be greatly appreciated.

Thanks!

Al

Upvotes: 0

Views: 1099

Answers (2)

David Avellan
David Avellan

Reputation: 414

As @LuisScott said, you don't need DocuSign API to do this. You would be better suited using DocuSign Connect. Much easier, you do not need to get code approval from DocuSign either.

DocuSign API is for modifying how DocuSign displays or modifies documents. In other words, pre-processing the envelope.

DocuSign Connect is for post-processing the envelope - which is what you want to do by your own account.

I had a similar question not too long ago that was answered here:

DocuSign Custom Connect - How to make a listener in php example?

Sample listener code:

https://github.com/docusign/docusign-soap-sdk/blob/master/PHP/Connect/index.php

My sample code to pull out form data:

// Figure out the URL of this server
// NOTE: DocuSign only pushes status to HTTPS!
$postBackPath = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
$postBackPath .= ($_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . $_SERVER['REQUEST_URI'] );
$postedXml = @file_get_contents('php://input');

if(!empty($postedXml)) {
    // see if this is a post to this page if it is then we have to save it.
    $xml = simplexml_load_string($postedXml);
    $post = $xml;
    print 'Got Envelope ID: ' . $xml->EnvelopeStatus->EnvelopeID . '<br />';
}

foreach($post->EnvelopeStatus->RecipientStatuses->RecipientStatus->FormData->xfdf->fields->children() as $element) {
        foreach($element->attributes() as $a) {
            $fieldArray[(string)$a] = (string)$element->value;
        }
    }

From there, you can do whatever you want with the data.

However, you do have to play around with some settings in DocuSign to get this to work. In particular, in the settings menu there is a DocuSign connect menu, where you can specify where your listener script is, what information you want passed (field data in your case), and when do you want data sent to the script (when envelope is completed).

Also, you have to have DocuSign Connect enabled for your account. If you have API access, you will have access to it as well but sometimes they need to turn it on for you.

Upvotes: 0

Luis
Luis

Reputation: 2702

Some options: 1) DocuSign connect can send you an XML payload with all of the tab data for all recipients 2) You can use the API (REST in this example) to query the tab details on a per recipient basis: https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#REST%20API%20References/Get%20Tab%20Information%20for%20a%20Recipient.htm%3FTocPath%3DREST%2520API%2520References%7C_____87

Upvotes: 1

Related Questions