【问题标题】:Docusign restapi download document using envelope id and document id使用信封ID和文档ID的Docusign restapi下载文档
【发布时间】:2017-06-29 07:26:47
【问题描述】:

我们在从 docusign 下载已完成信封的更新文档时遇到困难。我们正在执行 restapi 请求并取回数据,但不确定如何使用响应创建文档。

Restapi 请求:

GET https://demo.docusign.net/restapi/v2/accounts/xxxxx/envelopes/xxxxxx-    xxxxx-xxxxxxx-xxxxxxx/documents/1 HTTP/1.1
Accept: application/xml
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-AU,en;q=0.8,en-US;q=0.6
Content-Type: application/x-www-form-urlencoded
X-DocuSign-Authentication: { "Username" : "xxxxxxx", "Password" : "xxxxxxxx", "IntegratorKey" : "xxxxxxxxx" }
User-Agent: RestSharp/104.4.0.0
Host: demo.docusign.net
Connection: Keep-Alive

任何人都可以建议在我们收到回复以将其保存为 .pdf 后需要做什么。我们使用的是VB.net平台。

【问题讨论】:

    标签: vb.net restsharp docusignapi


    【解决方案1】:

    您可以使用DocuSign.eSign.dll nuget 包并调用DocuSign api。

    这是一个用于下载文档的示例 VB.net 代码。查看完整代码here

    Public Class DocuSignApiTest
         Public Sub GetDocumentRecipe()
             Dim envelopeId As String = "<EnvelopeId>"
             Dim accountId As String = Init()
             Dim envApi = New EnvelopesApi()
             Dim docStream = envApi.GetDocument(accountId, envelopeId, "1")
    
             ' let's save the document to local file system
             Dim filePath As String = "C:\temp\" + Path.GetRandomFileName() + ".pdf"
    
             Using stream = File.Create(filePath)
                 docStream.CopyTo(stream)
             End Using
         End Sub
    
         Public Function Init() As String
    
    
             Dim username As String = "<Username>"
             Dim password As String = "<Password>"
             Dim integratorKey As String = "<IntegratorKey>"
    
             ' initialize client for desired environment (for production change to www)
             Dim apiClient As New ApiClient("https://demo.docusign.net/restapi")
             Configuration.[Default].ApiClient = apiClient
    
             ' configure 'X-DocuSign-Authentication' header
             Dim authHeader As String = "{""Username"":""" + username + """, ""Password"":""" + password + """, ""IntegratorKey"":""" + integratorKey + """}"
             Configuration.[Default].AddDefaultHeader("X-DocuSign-Authentication", authHeader)
    
             ' we will retrieve this from the login API call
             Dim accountId As String = Nothing
    
             '''//////////////////////////////////////////////////////////////
             ' STEP 1: LOGIN API        
             '''//////////////////////////////////////////////////////////////
    
             ' login call is available in the authentication api 
             Dim authApi As New AuthenticationApi()
             Dim loginInfo As LoginInformation = authApi.Login()
    
             ' parse the first account ID that is returned (user might belong to multiple accounts)
             accountId = loginInfo.LoginAccounts(0).AccountId
    
             ' Update ApiClient with the new base url from login call
             apiClient = New ApiClient(loginInfo.LoginAccounts(0).BaseUrl)
    
             Return accountId
         End Function
    
     End Class
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多