【问题标题】:How to get back file from Docusign template using REST Api?如何使用 REST Api 从 Docusign 模板中取回文件?
【发布时间】:2021-01-01 02:31:24
【问题描述】:

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

我在这里粘贴代码,该代码使用文档 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

问候和感谢 阿拉文德

【问题讨论】:

  • 其实我对docusign知之甚少,但正如我已经指出的那样,“从模板中检索文件”对您的要求的描述不够清楚。因此,与其说“你应该已经知道我的意思”,不如按照要求更清楚地解释自己。否则,我们帮不了你。如果我们完全理解你,我们就不需要要求澄清了。也许还可以向我们展示您使用 DLL 所做的代码,然后我们可以尝试通过 API 了解等效功能。请帮助我们帮助您,而不是批评帮助者。谢谢。
  • 也许,你猜想,你想要this method,但我不能从模糊的描述中确定。
  • 嗨,我是docusign产品的新手,我找不到使用api从模板中检索文件的代码,所以我无法显示api级别的代码。
  • 好的。那么,我向您展示的最后一个链接是否提供了您想要的功能?我们只能猜测,因为您还没有更详细地解释您要做什么。
  • 我回滚了您的编辑,因为它使现有的 cmets 和答案变得荒谬。如果您有新问题,请提出新问题。你不会附加到旧的、已完成的问题上。这不是这个网站的工作方式。谢谢。

标签: vb.net docusignapi


【解决方案1】:

@aravindb 你可以使用这个端点:https://developers.docusign.com/docs/esign-rest-api/reference/Templates/TemplateDocuments/get/https://github.com/docusign 有 6 种语言的 31 个示例,您可以在其中查看如何下载文档

【讨论】:

  • 嗨,上面我更新了使用 Rest Api 取回文件的描述,但是当我转换为字节时出现错误。对于下载文件,我传递了 templateid 和 documentid 以及。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-08-11
  • 1970-01-01
  • 2018-02-27
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多