Blog
Home/

JSON to SDK Program Generator

Larry Kluger
Larry KlugerDocuSign Lead Product Manager for Partner Platforms
Summary3 min read

The new JSON to SDK online tool instantly creates Docusign eSignature API programs in C#, PHP, Java, Node.js, Python, Ruby, and VB.NET from JSON source.

    • Embedded or remote (email) recipients
    • How does it work? 
    • Open Source!
    • Additional resources

    Table of contents

    JSON to SDK

    As we've previously announced, we're working on a new tool, the forthcoming API Request Builder, that can generate Docusign eSignature REST SDK programs for C#, PHP, Java, Node.js, Python, and Ruby from a JSON source. It can also generate VB.NET programs that call the API directly.

    We’ve now extracted the code that translates the JSON object to an SDK program into a new standalone online tool, JsonToSDK.dshackathon.com.

    The tool has two windows: one for the JSON input and one for the SDK program output. See the screenshot, above.

    The output window is live; it is immediately updated when you make a change to the source JSON in the input window.

    To run the generated program:

    1. Select Download Framework to download the ancillary files for running the program. These files include example source documents, package manager files, and more.

    2. Select Download Code to download the generated code to replace the skeleton program file included with the framework.

    3. Invoke your language’s package manager to download the Docusign SDK.

    4. Add an access token and account ID to the source file.

    5. Run the program.

    For production, you must use an OAuth flow to obtain an access token. You will also need the account’s base URI (used for the basePath variable in the code). Obtain the base URI from the /oauth/userinfo API call.

    Embedded or remote (email) recipients

    The first version of the tool only supports the Envelopes:create and EnvelopeViews:createRecipient API calls. If the JSON includes a top-level createRecipientViewReq attribute, then the generated program will request an embedded signing ceremony URL for the first recipient.

    When the tool is started, the initial example JSON demonstrates an envelope with an embedded signing ceremony.

    How does it work? 

    Each time the input JSON is changed, the tool checks that it’s valid JSON. If it isn’t, then the tool shows a message and colors the appropriate section of the source red.

    The tool then uses recursion to walk the JSON tree and generate the matching calls to the selected SDK. (The VB.NET program directly uses the JSON source.) A reduced version of the eSignature API’s Swagger file is used to check the names of the complex attributes (arrays and objects) and the types of their attributes. The intermediate output of this process is then used with a language-specific template file to generate the tool’s output window.

    A program is included with the source code to reduce the Swagger file.

    Open Source!

    The JSON to SDK source is available on GitHub. It is a React.JS application and uses the React-Bootstrap UX library. There is no server component. When you “download” the output code from the tool, the React application is creating the file object on-the-fly: you’re “downloading” from the browser, not from a server.

    Let us know what you think via the comments/issues for the repository. You can also ask questions about the tool there. Pull requests that use the MIT License are welcomed.

    Additional resources

    Larry Kluger
    Larry KlugerDocuSign Lead Product Manager for Partner Platforms

    Larry Kluger has over 40(!) years of tech industry experience as a software developer, developer advocate, entrepreneur, and product manager. An award-winning speaker with a 48K StackOverflow reputation, he enjoys giving talks and helping the ISV and developer communities.

    Twitter: @larrykluger

    LinkedIn: https://www.linkedin.com/in/larrykluger/

    More posts from this author

    Related posts

    • Developers

      Introducing OAuth for Connect: enhanced security for webhooks

      Alan Roza
      Alan Roza
    • Updated Docusign University Learning Portal for Developers

      Sasha Vodnik
      Sasha Vodnik
    • Recipient Connect

      Larry Kluger
      Larry Kluger

    Introducing OAuth for Connect: enhanced security for webhooks

    Alan Roza
    Alan Roza

    Updated Docusign University Learning Portal for Developers

    Sasha Vodnik
    Sasha Vodnik

    Recipient Connect

    Larry Kluger
    Larry Kluger

    Discover what's new with Docusign IAM or start with eSignature for free

    Explore Docusign IAMTry eSignature for Free
    Person smiling while presenting