Trending Topics: Latest from our forums (September 2020)

Trending Topics

Here are some of the latest popular questions that the DocuSign developers community asked on Stack Overflow in the month of September 2020. You too can ask questions by using the tag docusignapi in Stack Overflow.

Thread: How to get back file from Docusign template using REST Api?

https://stackoverflow.com/questions/63883113/

Summary: The developer is using eSignature templates to send envelopes. They are trying to get a specific document from a specific template using the DocuSign eSignature REST API in VB.NET.

Answer: First of all, for VB.NET developers, I would like to point out it’s possible to use the C# SDK. That SDK is a .DLL (nuget package) that works for anyone using the .NET Framework.

The specific endpoint that should be used is TemplatesDocument::get; it returns a specific document from a specific endpoint. This can be used directly or via the SDK.

Thread: Create a valid JWT Token for DocuSign API

https://stackoverflow.com/questions/63782355/  

Summary: The developer is attempting to use JWT (JSON Web Token) Authentication and is having problems obtaining an access token. 

Answer: It’s recommended to use one of the eSignature SDKs to use JWT. They all include a method that makes it easier for developers to complete the process. 

If you're still running into issues, common problems with JWT include:

  • Not obtaining consent
  • Using the public key of the RSA instead of the private one.
  • Using a malformed RSA key. The key must match exactly, including newline characters, as provided when copy/pasted from DocuSign.
  • Not using the correct UserId (GUID) in the request.
  • Not requesting the "impersonation" scope in consent (#1 above).

Thread: In Docusign using with Chilkat dll , how to pass templateRoles in json?

https://stackoverflow.com/questions/63931690  

Summary: The developer is trying to use Visual Basic (VB.NET) to send envelopes using a template.

Answer: The following code was provided by using the Telerik(R) Code Converter from C# to VB.NET. The C# code came from the C# Code Examples (also known as the Code Launcher).

Imports System 
Imports System.Collections.Generic 
Imports DocuSign.eSign.Api 
Imports DocuSign.eSign.Client 
Imports DocuSign.eSign.Model 
Imports Microsoft.AspNetCore.Mvc 

Private Function DoWork(BVal signerEmail As String, ByVal signerName As String, ByVal ccEmail As String, ByVal ccName As String, ByVal accessToken As String, ByVal basePath As String, ByVal accountId As String, ByVal templateId As String) As String 
  Dim config = New Configuration(New ApiClient(basePath)) 
  config.AddDefaultHeader("Authorization", "Bearer " & accessToken) 
  Dim envelopesApi As EnvelopesApi = New EnvelopesApi(config) 
  Dim envelope As EnvelopeDefinition = MakeEnvelope(signerEmail, signerName, ccEmail, ccName, templateId) 
  Dim result As EnvelopeSummary = envelopesApi.CreateEnvelope(accountId, envelope) 
  Return result.EnvelopeId 
End Function 

Private Function MakeEnvelope(ByVal signerEmail As String, ByVal signerName As String) As EnvelopeDefinition 
  Dim buffer As Byte() = System.IO.File.ReadAllBytes(Config.docPdf) 
  Dim envelopeDefinition As EnvelopeDefinition = New EnvelopeDefinition() 
  envelopeDefinition.EmailSubject = "Please sign this document" 
  Dim doc1 As Document = New Document() 
  Dim doc1b64 As String = Convert.ToBase64String(buffer) 
  doc1.DocumentBase64 = doc1b64 
  doc1.Name = "Lorem Ipsum" 
  doc1.FileExtension = "pdf" 
  doc1.DocumentId = "3" 
  envelopeDefinition.Documents = New List(Of Document) From { doc1 } 
  Dim signer1 As Signer = ew Signer With { .Email = signerEmail, .Name = signerName, .ClientUserId = signerClientId, .RecipientId = "1" } 
  Dim signHere1 As SignHee = New SignHere With { .AnchorString = "/sn1/", .AnchorUnits = "pixels", .AnchorXOffset = "10", .AnchorYOffset = "20" } 
  Dim signer1Tabs As Tabs = New Tabs With { .SignHereTabs = New List(Of SignHere) From { signHere1 } }
  signer1.Tabs = signer1Tabs 
  Dim recipients As Recipients = New Recipients With { .Signers = New List(Of Signer) From { signer1 } } 
  envelopeDefinition.Recipients = recipients 
  envelopeDefinition.Status = "sent" 
  Return envelopeDefinition 
End Function

To use this code, you would need to include the DocuSign eSign Nuget DLL in your project.

Additional resources

Inbar Gazit
Author
Inbar Gazit
Sr. Manager, Developer Content
Published