cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Tutorial: Using the DocuSign eSignature REST API with the REST Snap Pack and OAuth 2.0

robin
Former Employee

DocuSignโ€™s latest REST API version is 2.1 and also supports OAuth 2.0 authentication (replacing the legacy X-DocuSign-Authentication header-based auth).

DocuSign also provides free (no credit card neccessary) developer accounts to try out their API.

First, sign up for a DocuSign developer account here: DocuSign Developer Account

image

Next, in the DocuSign Apps and Keys page inside the DocuSign Settings application, youโ€™ll see your account information, including API Username, API Account ID, and Accountโ€™s Base URI.

Click on the blue โ€œAdd App & Integration Keyโ€ button:

image

Provide an appropriate application name and click โ€œAddโ€:

image

On the next page, your Integration Key (also known as a โ€œClient IDโ€) will be displayed. Under the โ€œAuthenticationโ€ section, ensure the โ€œAuthorization Code Grantโ€ radio button is enabled for a โ€œUser Applicationโ€. Then click on โ€œAdd Secret Keyโ€:

image

IMPORTANT! Copy this secret key value immediately and paste it somewhere just for now - it will no longer be available to be used once you navigate away from this page.

Further down, under โ€œAdditional settingsโ€, click the โ€œAdd URIโ€ button and paste in the following value: https://elastic.snaplogic.com/api/1/rest/admin/oauth2callback/rest

image

Finally, click the โ€œSaveโ€ button and youโ€™ll return to the โ€œApps and Keysโ€ section of the Developer admin console, where your application will now be visible.

Next, log into SnapLogicโ€™s Designer web application, create a new pipeline and drag a REST GET Snap to the empty canvas. Switch to the โ€œAccountโ€ tab and click the โ€œAdd Accountโ€ button:

image

Now itโ€™s time to use the values from the DocuSign developer/integration web console - in another tab, click on the application you created within DocuSign and enter the following information:

image

Since we are using the DocuSign Demo Environment, weโ€™ll be using the demo-specific account-d.docusign.com domain - the -d suffix is reserved for demo use.

Click the โ€œAuthorizeโ€ button towards the bottom to initiate the process to get an OAuth 2.0 access token.

Your web browser will send a request to the OAuth2 Endpoint URL (the Auth endpoint) - you may be asked to login and possibly to approve the application. After doing so, the request will redirect back to the SnapLogic platform (the redirect_uri where a new token request to the โ€œOAuth2 Tokenโ€ URL (the token endpoint) will automatically take place in the background and an access- and refresh tokens will be acquired.

If all goes well, the browser will navigate back to the SnapLogic Designer and your account will now have encrypted entries for the โ€œAccess-โ€ and โ€œRefresh tokenโ€ fields, plus a timestamp value for the โ€œAccess token expirationโ€ settings field.

Click โ€œApplyโ€ to save the account and we can now test that the access token we received is valid by making requests to the DocuSign eSignature REST API:

image

GET User Info

The first request will be to the User Info endpoint - https://account-d.docusign.com/oauth/userinfo

image

This endpoint will return environment data such as accountId, userId, and baseUrl - these are required to make any eSignature API call:

image

For Each Account

Since the responseโ€™s entity.accounts is an array, we can use the JSON splitter to operate on the account data that we will leverage in subsequent API calls:

image

GET Account Info

Finally, we can now make a call to the DocuSign eSignature REST API.

After the Splitter add another REST GET Snap, configure it with the same account used previously, and leverage the ability to refer to the input data ($base_uri, $account_id) to build the request URL to the demo.docusign.net API domain:

image

Validating and/or executing this Snap should result in a 200 OK response with a response body containing the metadata of the desired account, which can be further isolated with a Mapper mapping the $entity field to $:

image

And that should get your started. Consult the DocuSign REST API reference documentation to learn about other endpoints that can be used.

3 REPLIES 3

snowamigo
New Contributor

Is it possible to document something using JWT tokens when integrating with DocuSign?

sanjaynayak
New Contributor III

@robin

I am trying to set up REST OAuth2 Account set up in snaplogic,getting below message on click Authorize button.

{โ€œresponse_mapโ€: {โ€œerror_listโ€: [{โ€œmessageโ€: โ€œAccess token value is emptyโ€}]}, โ€œhttp_status_codeโ€: 500}

I am providing all mandatory information.

1- Client ID*

2-client secret

3- OAuth2 Endpoint*

4-OAuth2 Token =https://servername.mktorest.com/identity/oauth/token*

5-Grant Type= client_credentials

Will snaplogic binding all input parameter to this url (client id ,client secret etcโ€ฆ)(https://servername.mktorest.com/identity/oauth/token ) or we need to bind in token endpoint config!

Any suggestion would be help full.

This is the post man url which one is working fine and giving new token (https://{{base_url}}.mktorest.com/identity/oauth/token?grant_type=client_credentials&client_id={{cli...)