Reputation: 5166
I am using the php Api for docusign . Got it from here. What i want is to get the url of the signed DOC . Is it possible to get that. ?I am using the following code.
$username = $option['docu_username'];
$password =$option['docu_pass'];
$integrator_key = $option['docu_integrator_key'];
$host = $option['docu_host'];
// create a new DocuSign configuration and assign host and header(s)
$config = new DocuSign\eSign\Configuration();
$config->setHost($host);
$config->addDefaultHeader("X-DocuSign-Authentication", "{\"Username\":\"" . $username . "\",\"Password\":\"" . $password . "\",\"IntegratorKey\":\"" . $integrator_key . "\"}");
/////////////////////////////////////////////////////////////////////////
// STEP 1: Login() API
/////////////////////////////////////////////////////////////////////////
// instantiate a new docusign api client
$apiClient = new DocuSign\eSign\ApiClient($config);
// we will first make the Login() call which exists in the AuthenticationApi...
$authenticationApi = new DocuSign\eSign\Api\AuthenticationApi($apiClient);
// optional login parameters
$options = new \DocuSign\eSign\Api\AuthenticationApi\LoginOptions();
// call the login() API
$loginInformation = $authenticationApi->login($options);
// parse the login results
if(isset($loginInformation) && count($loginInformation) > 0)
{
// note: defaulting to first account found, user might be a
// member of multiple accounts
$loginAccount = $loginInformation->getLoginAccounts()[0];
if(isset($loginInformation))
{
$accountId = $loginAccount->getAccountId();
}
}
if(empty($accountId))
{
return false;
}
/////////////////////////////////////////////////////////////////////////
// STEP 2: Create & Send Envelope (aka Signature Request)
/////////////////////////////////////////////////////////////////////////
// set recipient information
// instantiate a new envelopeApi object
$envelopeApi = new DocuSign\eSign\Api\EnvelopesApi($apiClient);
// Add a document to the envelope
$document = new DocuSign\eSign\Model\Document();
$document->setDocumentBase64(base64_encode(file_get_contents($documentFileName)));
$document->setName($documentName);
$document->setDocumentId("1");
// Create a |SignHere| tab somewhere on the document for the recipient to sign
$signHere = new \DocuSign\eSign\Model\SignHere();
$signHere->setXPosition("20");
$signHere->setYPosition("20");
$signHere->setDocumentId("1");
$signHere->setPageNumber("1");
$signHere->setRecipientId("1");
// add the signature tab to the envelope's list of tabs
$tabs = new DocuSign\eSign\Model\Tabs();
$tabs->setSignHereTabs(array($signHere));
// add a signer to the envelope
$signer = new \DocuSign\eSign\Model\Signer();
$signer->setEmail($recipientEmail);
$signer->setName($recipientName);
$signer->setRecipientId("1");
$signer->setClientUserId('12345');
$signer->setTabs($tabs);
// Add a recipient to sign the document
$recipients = new DocuSign\eSign\Model\Recipients();
$recipients->setSigners(array($signer));
$envelop_definition = new DocuSign\eSign\Model\EnvelopeDefinition();
$envelop_definition->setEmailSubject("Please sign this doc");
// set envelope status to "sent" to immediately send the signature request
$envelop_definition->setStatus("sent");
$envelop_definition->setRecipients($recipients);
$envelop_definition->setDocuments(array($document));
// create and send the envelope! (aka signature request)
$envelop_summary = $envelopeApi->createEnvelope($accountId, $envelop_definition, null);
$viewrequest = new DocuSign\eSign\Model\RecipientViewRequest();
$viewrequest->setUserName($recipientName);
$viewrequest->setEmail($recipientEmail);
$viewrequest->setRecipientId(1);
$viewrequest->setClientUserId('12345');
$viewrequest->setAuthenticationMethod('email');
$viewrequest->setReturnUrl($ReturnUrl);
$envelopview=$envelopeApi->createRecipientView($accountId,$document->envelopeId,$viewrequest);
$redirecturl=$envelopview->getUrl();
Upvotes: 0
Views: 1382
Reputation: 9356
Just as @jfneis mentioned, you need to use the getDocument()
API to retrieve the actual signed document bytes for an envelope. Before you do that though, you make the listDocuments()
request to get the actual document endpoints for downloading each doc.
Note that each endpoint to download envelope docs will contain the documentId
as part of the URL. So if you have envelope "AAA" with two documents (IDs 1001 and 1002), for example, to download them you would do:
GET v2/accounts/12345/envelopes/AAA/documents/1001
GET v2/accounts/12345/envelopes/AAA/documents/1002
Upvotes: 0
Reputation: 2197
Yes, it is. You can list an envelope's documents and get it too.
Take a look at listDocuments
and getDocument
methods. I don't program in PHP so I can't provide you examples, but just checked the GitHub PHP SDK repo and its available too.
By the way, using the REST API directly there is /accounts/{{accid}}/envelopes/{{envid}}/documents/combined
endpoint that provides you all documents of an envelope in a single PDF, but I couldn't find anything similar into the SDK (neither in Java or PHP).
Hope it helps!
Upvotes: 1