文档有textTabs但不会将文档作为pdf返回

时间:2015-07-27 06:04:41

标签: docusignapi

我正在使用api创建一个包含单个文档的信封。我正在使用textTabs将一些信息传递给文档,这工作正常,我认为这是正确的方式来做一个mailmerge,据我所知。

但是,现在我正在尝试将文档作为PDF检索回来,我将其取回,但它没有textTabs。为什么会这样?

编辑:这是我的信封创建,我已经剪掉了一些标签。

<envelopeDefinition xmlns="http://www.docusign.com/restapi">
  <status>sent</status>
  <emailSubject>DocuSign API - Embedded Signing example</emailSubject>
  <enableWetSign>false</enableWetSign>
  <templateId>a5413dda-74a6-40a1-b9c5-de5634ba32ab</templateId>
  <templateRoles>
    <templateRole>
      <email>email@email.com</email>
      <name>Fred Bloggs</name>
      <roleName>Customer</roleName>
      <clientUserId>1</clientUserId>
      <tabs>
        <textTabs>
          <text>
            <anchorString>[DealerName]</anchorString>
            <tabLabel>label</tabLabel>
            <value>Fred Bloggs Dealer</value><font>Arial</font>
            <fontSize>Size10</fontSize>
            <bold>true</bold>
            <locked>true</locked>
            <documentId>1</documentId>
            <pageNumber>1</pageNumber>
          </text>
          <text>
            <anchorString>[DealerABN]</anchorString>
            <tabLabel>label</tabLabel>
            <value>12345678901</value><font>Arial</font>
            <fontSize>Size10</fontSize>
            <bold>true</bold>
            <locked>true</locked>
            <documentId>1</documentId>
            <pageNumber>1</pageNumber>
          </text>
        </textTabs>
      </tabs>
    </templateRole>
  </templateRoles>
</envelopeDefinition>

这很好用,我可以看到docusign上文档中填写的标签。

然后我检索文档uri并使用以下代码将其作为PDF获取,取自API演练:

Dim url As String = BaseURL + "/envelopes/" + EnvelopeID + "/documents"

Dim request As HttpWebRequest = initializeRequest(url, "GET", Nothing, DocuSignUserName, DocuSignPassword, DocuSignIntegratorKey)

Dim response As String = GetResponseBody(request)

Dim doc As New XmlDocument()
doc.LoadXml(response)
Dim nsmgr As New XmlNamespaceManager(doc.NameTable)
nsmgr.AddNamespace("x", "http://www.docusign.com/restapi")

Dim DocumentUri As String = Nothing
For Each DocumentNode As XmlNode In doc.SelectNodes("x:envelopeDocumentsResult/x:envelopeDocuments/x:envelopeDocument", nsmgr)
    Dim IdNode As XmlNode = DocumentNode.SelectSingleNode("x:documentId", nsmgr)
    If (IdNode IsNot Nothing) Then
        If (String.Compare(IdNode.InnerText, DocumentId, True) = 0) Then
            Dim UriNode As XmlNode = DocumentNode.SelectSingleNode("x:uri", nsmgr)
            If (UriNode IsNot Nothing) Then
                DocumentUri = UriNode.InnerText()
            End If
        End If
    End If
Next

If (DocumentUri = Nothing) Then
    Throw New Exception("DocumentId '" + DocumentId + "' not found")
End If

url = BaseURL + DocumentUri
request = initializeRequest(url, "GET", Nothing, DocuSignUserName, DocuSignPassword, DocuSignIntegratorKey)
request.Accept = "application/pdf"

但PDF只有模板信息,标签缺失

1 个答案:

答案 0 :(得分:0)

选项卡始终特定于收件人,这意味着选项卡只能分配给收件人,并且不会按照说法“归属”文档。如果您想要检索标签信息,请尝试进行Get Tab Information for Recipient API调用。

来自文档的示例请求:

GET https://{server}/restapi/{apiVersion}/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs

X-DocuSign-Authentication: <DocuSignCredentials><Username>{name}</Username><Password>{password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>
Accept: application/json
Content-Type: application/json

示例回复:

{
  "textTabs":[{
    <Tab information removed>
  }],
  "titleTabs":[{
    <Tab information removed>
  }],
  "signHereTabs":[{
    <Tab information removed>
 }]
}