153 Docusign API code examples (and more to come!)
Get code examples in all our supported SDK languages.
The easiest way to write software is to start with “known-good” software, then update it to meet your own specific requirements. Starting with software you know works also helps with debugging.
In 2018, I focused on re-writing the Docusign eSignature API code examples for our developers, providing new examples that are easier to use, more representative of real-world use cases and patterns, and supporting more programming languages. We now have the following examples:
New workflow code examples that use the current versions of the Docusign SDKs are available on github.com/docusign in all of our primary languages: C#, PHP, Java, Node.js, Python, and Ruby. Code examples showing how to call the API directly are also available. They use the cURL utility.
Each new code example has been grouped into a launcher, which provides access to all of the workflow code examples for a given language. Each launcher includes software for authenticating with Docusign via either the Authorization Code Grant flow or the JWT Grant flow.
Each workflow code example can be used with either type of authentication. For example, you can list and then download an envelope’s documents (workflow examples 6 and 7) using either the Authorization Code or JWT Grant flows--all you need to do is pass in an access token, account_id, and base_path from the authentication flow. The primary launchers, each of which includes 14 – 18 workflow examples, are the Github repositories that include support for the OAuth Authorization Code Grant flow
Getting started with the code example launchers
So how do you use them? First, decide which language you want to use: C#, PHP, Java, Node.js, Python, Ruby, or the direct API examples via cURL. Next, click the link, download the launcher’s repository, and follow the instructions in the readme file for configuring and running it.
The example projects listed above all implement Authorization Code Grant authentication to obtain an access token, but we also provide examples of how to implement the OAuth JWT Grant flow. You can access code examples that implement JWT authentication from the following list: C# .NET Core, C# .NET Framework, PHP, Java, Node.js, Python, and Ruby.
Notable workflow code examples
The code example launchers include many different workflow examples. Here are some of the most notable examples.
The embedded signing example (example workflow 1 of the authorization code grant launchers) demonstrates a good UI for embedding the Docusign Signing Ceremony within your app’s flow. Note the busy indicator that’s used to reassure the user that something is happening.
The sign via email example (example workflow 2) demonstrates how an envelope can include multiple documents of different source types.
Sending an envelope with binary upload of the documents (example workflow 10) demonstrates the best way to send envelopes that include large documents or document sets.
What’s Next
Within the Docusign DevCenter team, we’re working to add additional workflow examples to the launchers. We’re also working on articles about each workflow example, which will be published in the DevCenter.
If you have an idea for a new code example, please let me know via developers@docusign.com.
Larry Kluger has over 40 years of tech industry experience as a software developer, developer advocate, entrepreneur, and product manager. An award-winning speaker prominent StackOverflow contributor, he enjoys giving talks and helping the ISV and developer communities.
Twitter: @larrykluger
LinkedIn: https://www.linkedin.com/in/larrykluger/
Related posts