如何使用 REST Api 从 Docusign 模板取回文件?

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

我可以使用 templateid 发送文件,在 Docusign api 中使用 REST api 获取模板列表,现在我想使用 REST Api 从模板获取文件。 我可以在我的帐户中获取模板列表,并且可以循环并获取准确的模板 ID。从那以后,我想使用 Rest api 代码取回文件。请帮助我们提供如何调用 rest api 以从 Docusing api 的 templatesid 中​​获取文件。使用 Docusing dll,我可以检索文件,但我需要使用 Rest Api .

来检索

我在这里粘贴使用 docusing dll 从 docusing 模板下载文件的代码。

Private Function DoWork(ByVal accessToken As String, ByVal basePath As String, ByVal accountId As String, ByVal envelopeId As String, ByVal documents As List(Of EnvelopeDocItem), ByVal docSelect As String) As FileStreamResult
    Dim config = New Configuration(New ApiClient(basePath))
    config.AddDefaultHeader("Authorization", "Bearer " & accessToken)
    Dim envelopesApi As EnvelopesApi = New EnvelopesApi(config)
    Dim results As System.IO.Stream = envelopesApi.GetDocument(accountId, envelopeId, docSelect)
    Dim docItem As EnvelopeDocItem = documents.FirstOrDefault(Function(d) docSelect.Equals(d.DocumentId))
    Dim docName As String = docItem.Name
    Dim hasPDFsuffix As Boolean = docName.ToUpper().EndsWith(".PDF")
    Dim pdfFile As Boolean = hasPDFsuffix
    Dim docType As String = docItem.Type

    If ("content".Equals(docType) OrElse "summary".Equals(docType)) AndAlso Not hasPDFsuffix Then
        docName += ".pdf"
        pdfFile = True
    End If

    If "zip".Equals(docType) Then
        docName += ".zip"
    End If

    Dim mimetype As String

    If pdfFile Then
        mimetype = "application/pdf"
    ElseIf "zip".Equals(docType) Then
        mimetype = "application/zip"
    Else
        mimetype = "application/octet-stream"
    End If
   
    Return File(results, mimetype, docName)
    
End Function

问候和感谢 亚拉文

@aravindb 你可以使用这个端点:https://developers.docusign.com/docs/esign-rest-api/reference/Templates/TemplateDocuments/get/. As well there are 31 examples in 6 languages at https://github.com/docusign 在那里你可以看到如何下载文件