Docusign -GET an Envelope's status using the REST API

The code below will query an envelope's status using the REST API. 

There is some information that we assume you know, be sure that you are able to run this code

http://dyndeveloper.com/ArticleView.aspx?ArticleID=4058

Before you look at this. 

 

 

Public Sub CheckEnvelopeStatus(strAccountID As String, strUserName As String, strPassword As String, strIngegratorKey As String, strEnvelopeID As String)
    Try
 
        'needed to upgrade my project to .NET 4.5.1 to have this available
        ServicePointManager.Expect100Continue = True
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
        Dim oRequest As System.Net.HttpWebRequest
        Dim oResponse As System.Net.WebResponse = Nothing
        Dim oPostStream As System.IO.Stream = Nothing
 
        'form the url
        Dim strUrl As String = String.Format("https://demo.docusign.net/restapi/v2.1/accounts/{0}/envelopes/{1}", strAccountID, strEnvelopeID)
 
 
        ' Create the web request
        oRequest = DirectCast(System.Net.WebRequest.Create(strUrl), System.Net.HttpWebRequest)
        oRequest.Method = "GET"
        oRequest.Accept = "application/json"
        oRequest.ContentType = "application/json"
 
        ' Add authentication to request
        oRequest.Headers.Add("X-DocuSign-Authentication", String.Format("<DocuSignCredentials><Username>{0}</Username><Password>{1}</Password><IntegratorKey>{2}</IntegratorKey></DocuSignCredentials>", strUserName, strPassword, strIngegratorKey))
        'oRequest.ContentLength = 0
 
        ' Get the response
        oResponse = DirectCast(oRequest.GetResponse(), System.Net.WebResponse)
 
        'convert the response to a Stream
        Dim oStream As System.IO.Stream = oResponse.GetResponseStream()
        'convert the Stream to a StreamReader
        Dim oStreamReader As New System.IO.StreamReader(oStream)
        'read the response into a String
        Dim strResponse As String = oStreamReader.ReadToEnd
        Stop
 
        'This is the result of this call
 
        '{
        '    "status": "sent",
        '    "documentsUri": "/envelopes/ed9144bd-de4c-41f6-8a2a-e511da31c635/documents",
        '    "recipientsUri": "/envelopes/ed9144bd-de4c-41f6-8a2a-e511da31c635/recipients",
        '    "attachmentsUri": "/envelopes/ed9144bd-de4c-41f6-8a2a-e511da31c635/attachments",
        '    "envelopeUri": "/envelopes/ed9144bd-de4c-41f6-8a2a-e511da31c635",
        '    "emailSubject": "Please sign this document",
        '    "envelopeId": "ed9144bd-de4c-41f6-8a2a-e511da31c635",
        '    "signingLocation": "online",
        '    "customFieldsUri": "/envelopes/ed9144bd-de4c-41f6-8a2a-e511da31c635/custom_fields",
        '    "notificationUri": "/envelopes/ed9144bd-de4c-41f6-8a2a-e511da31c635/notification",
        '    "enableWetSign": "true",
        '    "allowMarkup": "false",
        '    "allowReassign": "true",
        '    "createdDateTime": "2020-10-12T14:53:39.3600000Z",
        '    "lastModifiedDateTime": "2020-10-12T14:53:39.3770000Z",
        '    "initialSentDateTime": "2020-10-12T14:53:40.2030000Z",
        '    "sentDateTime": "2020-10-12T14:53:40.2030000Z",
        '    "statusChangedDateTime": "2020-10-12T14:53:40.2030000Z",
        '    "documentsCombinedUri": "/envelopes/ed9144bd-de4c-41f6-8a2a-e511da31c635/documents/combined",
        '    "certificateUri": "/envelopes/ed9144bd-de4c-41f6-8a2a-e511da31c635/documents/certificate",
        '    "templatesUri": "/envelopes/ed9144bd-de4c-41f6-8a2a-e511da31c635/templates",
        '    "expireEnabled": "true",
        '    "expireDateTime": "2021-02-09T14:53:40.2030000Z",
        '    "expireAfter": "120",
        '    "sender": {
        '        "userName": "Steve Gray",
        '        "userId": "00000000-0000-0000-0000-000000000000",
        '        "accountId": "00000000-0000-0000-0000-000000000000",
        '        "email": "me@mydomain.com"
        '    },
        '    "purgeState": "unpurged",
        '    "envelopeIdStamping": "true",
        '    "is21CFRPart11": "false",
        '    "signerCanSignOnMobile": "true",
        '    "autoNavigation": "true",
        '    "isSignatureProviderEnvelope": "false",
        '    "hasFormDataChanged": "false",
        '    "allowComments": "true",
        '    "hasComments": "false",
        '    "allowViewHistory": "true",
        '    "envelopeMetadata": {
        '        "allowAdvancedCorrect": "true",
        '        "enableSignWithNotary": "true",
        '        "allowCorrect": "true"
        '    },
        '    "anySigner": null,
        '    "envelopeLocation":  "current_site",
        '    "isDynamicEnvelope": "false"
        '}
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
 
End Sub

 

 


RealWorldCode gives developers practical, real‑world solutions with clean, working code — no fluff, no theory, just answers.
Links
Home
Knowledge Areas
Sitemap
Contact
Et cetera
Privacy Policy
Terms and Conditions
Cookie Preferences