简体   繁体   中英

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

I can send file with templateid, get list of templates using REST api in Docusign api, now i want to get files from template using REST Api. I can get list of templates in my account and can loop and get exact template id. From that i want to get back files using Rest api code. Pls help us to provide how to call rest api to get files from templatesid from Docusing api. Using Docusing dll, i can retrieve files, but i need to retrieve using Rest Api .

Here i paste code which download file from docusing Template using docusing dll.

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

Regards and Thanks Aravind

@aravindb you can use this endpoint: 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 where you can see how to download documents

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM