Skip to content

Instantly share code, notes, and snippets.

@DSDevCenter
DSDevCenter / soap_create_envelope.php
Created February 16, 2018 05:03
DocuSign SOAP API - Create Envelope example in PHP
// Create the recipient
$rcp1 = new Recipient();// First recipient to put in recipient array
$rcp1->UserName = "John Doe";
$rcp1->Email = $Recipient1Email;
$rcp1->Type = RecipientTypeCode::Signer;
$rcp1->ID = "1";
$rcp1->RoutingOrder = 1;
$rcp1->RequireIDLookup = FALSE;
// Specify captive info to embed the recipient
@DSDevCenter
DSDevCenter / soap_embedded_signing.php
Created February 16, 2018 05:04
SOAP API Example - Embedded Signing PHP
// Construct the recipient token authentication assertion and specify
// ID, start time, method, and domain
$assertion = new RequestRecipientTokenAuthenticationAssertion();
$assertion->AssertionID = guid();
$assertion->AuthenticationInstant = nowXsdDate();
$assertion->AuthenticationMethod = RequestRecipientTokenAuthenticationAssertionAuthenticationMethod::Password;
$assertion->SecurityDomain = "Request Recipient Token Test";
// Construct the URLs based on UserName
$recip = $env->Recipients[0];
@DSDevCenter
DSDevCenter / soap_create_envelope.cs
Last active February 16, 2018 05:41
SOAP API Example - Create Envelope C#
// Create the recipient
DocuSignWeb.Recipient recipient = new DocuSignWeb.Recipient();
recipient.Email = "Test email";
recipient.UserName = "Testing account";
recipient.Type = DocuSignWeb.RecipientTypeCode.Signer;
recipient.ID = "1";
recipient.RoutingOrder = 1;
// Need to specify captive info to embed the recipient
recipient.CaptiveInfo = new DocuSignWeb.RecipientCaptiveInfo();
@DSDevCenter
DSDevCenter / soap_embedded_signing.cs
Created February 16, 2018 05:06
SOAP API Example - Embedded Signing C#
// Construct the recipient token authentication assertion
// Specify ID, start time, method and domain
DocuSignWeb.RequestRecipientTokenAuthenticationAssertion assertion
= new DocuSignWeb.RequestRecipientTokenAuthenticationAssertion();
assertion.AssertionID = new Guid().ToString();
assertion.AuthenticationInstant = DateTime.Now;
assertion.AuthenticationMethod
= DocuSignWeb.RequestRecipientTokenAuthenticationAssertionAuthenticationMethod.Password;
assertion.SecurityDomain = "Request Recipient Token Test";
@DSDevCenter
DSDevCenter / JavaSDKSamples.java
Created February 19, 2018 04:02
DocuSign Java SDK Samples for the eSignature REST API
package docusign_tests;
import com.docusign.esign.api.*;
import com.docusign.esign.client.*;
import com.docusign.esign.model.*;
import com.docusign.esign.client.auth.AccessTokenListener;
import org.apache.oltu.oauth2.common.exception.OAuthSystemException;
import org.apache.oltu.oauth2.common.token.BasicOAuthToken;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
@DSDevCenter
DSDevCenter / CSharpSDKSamples.cs
Created February 19, 2018 18:38
DocuSign C# SDK Samples for eSignature REST API
using DocuSign.eSign.Api;
using DocuSign.eSign.Client;
using DocuSign.eSign.Model;
using Microsoft.Owin.Hosting;
using Newtonsoft.Json;
using Owin;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
@DSDevCenter
DSDevCenter / getAuthCode.js
Created February 19, 2018 21:22
DocuSign NODE SDK Auth Code example for eSignature REST API
const express = require('express');
const passport = require('passport');
const util = require('util')
var session = require('express-session');
var docusign = require('./src/index');
const app = express();
const port = process.env.PORT || 3000;
const host = process.env.HOST || 'localhost';
@DSDevCenter
DSDevCenter / getAuthToken.js
Created February 19, 2018 21:44
DocuSign NODE SDK Example - Get OAuth access token
// Configure Passport
passport.use(new docusign.OAuthClient({
sandbox: true,
clientID: '{CLIENT_ID}',
clientSecret: '{CLIENT_SECRET}',
callbackURL: hostUrl + '/auth/callback'
},
function (accessToken, refreshToken, user, done) {
// Here we're just assigning the tokens to the user profile object but we
// could be using session storage or any other form of transient-ish storage
@DSDevCenter
DSDevCenter / getAuthCode.js
Created February 19, 2018 21:45
DocuSign NODE SDK Example - Get OAuth Authorization Code
const express = require('express');
const passport = require('passport');
const util = require('util')
var session = require('express-session');
var docusign = require('./src/index');
const app = express();
const port = process.env.PORT || 3000;
const host = process.env.HOST || 'localhost';
@DSDevCenter
DSDevCenter / getBaseUri.js
Created February 19, 2018 21:46
DocuSign NODE SDK Example - Get Base URI (note currently using a legacy endpoint, update coming soon)
// creating an instance of the authentication API
var authApi = new docusign.AuthenticationApi(apiClient);
var loginOps = {};
loginOps.apiPassword = 'true';
loginOps.includeAccountIdGuid = 'true';
// making login call. we could also use DocuSign OAuth userinfo call
authApi.login(loginOps, function (error, loginInfo, response) {
if (error) {
return res.send(error);
}