Skip to content

Instantly share code, notes, and snippets.

@Ergin008
Ergin008 / CreateAndSendEnvelope.cs
Last active January 7, 2016 23:08
code snippet that shows how to create and send an envelope using the DocuSign .NET client
// Read a file from disk to use as a document
byte[] fileBytes = File.ReadAllBytes("[PATH/TO/DOCUMENT/TEST.PDF]");
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc";
// Add a document to the envelope
Document doc = new Document();
doc.DocumentBase64 = System.Convert.ToBase64String(fileBytes);
doc.Name = "TestFile.pdf";
@Ergin008
Ergin008 / getRecipientView.php
Last active March 21, 2016 23:25
code snippet that shows how to request a recipient view (signing URL) using DocuSign PHP client
<?php
// instantiate a RecipientViewRequest object
$recipient_view_request = new \DocuSign\eSign\Model\RecipientViewRequest();
// set where the recipient is re-directed once they are done signing
$recipient_view_request->setReturnUrl("https://www.docusign.com/develcenter");
// configure the embedded signer
$recipient_view_request->setUserName($recipientName);
<?php
// set recipient information
$recipientName = "[RECIPIENT_NAME]";
$recipientEmail = "[RECIPIENT_EMAIL]";
// configure the document we want signed
$documentFileName = "[PATH/TO/DOCUMENT.PDF]";
$documentName = "TestFile.pdf";
@Ergin008
Ergin008 / LoginAPI.php
Last active March 21, 2016 23:23
code snippet that shows DocuSign Login API call using PHP client
<?php
require_once('./docusign-php-client/autoload.php');
// DocuSign account credentials & Integrator Key
$username = "[USERNAME]";
$password = "[PASSWORD]";
$integrator_key = "[INTEGRATOR_KEY]";
// DocuSign environment we are using
@Ergin008
Ergin008 / getRecipientView.cs
Last active January 7, 2016 23:17
code snippet that shows how to request a signing URL for a recipient
RecipientViewRequest viewOptions = new RecipientViewRequest()
{
ReturnUrl = "https://www.docusign.com/devcenter",
ClientUserId = "1234", // must match clientUserId set in step #2!
AuthenticationMethod = "email",
UserName = "[SIGNER_NAME]",
Email = "[SIGNER_EMAIL]"
};
// create the recipient view (aka signing URL)
@Ergin008
Ergin008 / CreateEnvelopeWithEmbeddedRecipient.cs
Last active July 9, 2016 02:17
code snippet that shows how to create an envelope using the DocuSign .NET client
// specify the document we want signed
string SignTest1File = @"[PATH/TO/DOCUMENT/TEST.PDF]";
// read a file from disk to use as a document.
byte[] fileBytes = File.ReadAllBytes(SignTest1File);
EnvelopeDefinition envDef = new EnvelopeDefinition();
envDef.EmailSubject = "[DocuSign C# SDK] - Please sign this doc";
// Add a document to the envelope
@Ergin008
Ergin008 / LoginAPI.cs
Last active July 9, 2016 02:15
code snippet that shows how to Login using DocuSign .NET client
// Download API Client and add to your project:
// https://github.com/docusign/docusign-csharp-client
using DocuSign.eSign.Api;
using DocuSign.eSign.Model;
using DocuSign.eSign.Client;
// Enter your credentials
string Username = "[EMAIL]";
string Password = "[PASSWORD]";
string IntegratorKey = "[INTEGRATOR_KEY]";
@Ergin008
Ergin008 / getRecipientView.java
Last active January 6, 2016 22:00
code snippet that shows how to request a recipient signing URL
// use the |accountId| we retrieved through the Login API
String accountId = loginAccounts.get(0).getAccountId();
// instantiate a new EnvelopesApi object
EnvelopesApi envelopesApi = new EnvelopesApi();
// set the url where you want the recipient to go once they are done signing
RecipientViewRequest returnUrl = new RecipientViewRequest();
returnUrl.setReturnUrl("https://www.docusign.com/devcenter");
returnUrl.setAuthenticationMethod("email");
// specify a document we want signed
String SignTest1File = "[PATH/TO/DOCUMENT/TEST.PDF]";
// create a byte array that will hold our document bytes
byte[] fileBytes = null;
try
{
String currentDir = System.getProperty("user.dir");
@Ergin008
Ergin008 / LoginAPI.java
Last active September 5, 2016 06:28
code snippet that shows the Login API
// Download API Client and add to your project:
// https://github.com/docusign/docuSign-java-client
import com.docusign.esign.api.*;
import com.docusign.esign.client.*;
import com.docusign.esign.model.*;
// Enter your DocuSign credentials
String UserName = "[EMAIL]";
String Password = "[PASSWORD]";
String IntegratorKey = "[INTEGRATOR_KEY]";