具有多个复合模板的不正确应用的服务器模板 [英] Incorrectly applied server templates with multiple composite templates

查看:46
本文介绍了具有多个复合模板的不正确应用的服务器模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力将DocuSign REST API集成到公司的应用程序中。事情大部分都在起作用,但仍然存在一个问题。如果我上载了多个(> = 2)文档,每个文档都有一个关联的服务器模板,那么所有模板最终都会应用到第一个文档。

I've been working on integrating the DocuSign REST API into my company's app. Things are mostly working, but there is still one problem. If I upload multiple (>= 2) documents, each with an associated server template, then all of the templates end up getting applied to the first document.

例如,对 / accounts / account_id / envelopes 的以下API调用应上传两个文档: document1.pdf (7页)和 document2.pdf (共2页)。 document1.pdf 的服务器模板在第7页上具有一个此处签名字段,而 document2.pdf 的服务器模板的第二页上有一个此处是签名字段。

For example, the following API call to /accounts/account_id/envelopes should upload two documents: document1.pdf (7 pages) and document2.pdf (2 pages). document1.pdf's server template has a sign-here field on the 7th page and document2.pdf's server template has a sign-here field on the 2nd page.

DocuSign网站上显示的是一个信封,上面正确地上传了两个文档,但 document2.pdf 的sign-here字段出现在 document1.pdf 的第2页上。如果我手动删除并在 document2.pdf 上重新应用模板,则该字段将正确放置。我怀疑这是由于我的 sequence 属性的一个细微问题引起的,但是我一直无法弄清楚到底是什么问题。

What appears on the DocuSign website is an envelope with the two documents correctly uploaded, but with document2.pdf's sign-here field appearing on page 2 of document1.pdf. If I manually remove and reapply the template on document2.pdf, then the field gets correctly placed. I suspect this is due to a subtle problem with my sequence attributes, but I have been unable to figure out exactly what is wrong.

{
  "allowReassign": false,
  "emailBlurb": "email text",
  "emailSubject": "subject",
  "status": "created",
  "compositeTemplates": [
    {
      "document": {
        "name": "document1.pdf",
        "documentId": "1"
      },
      "serverTemplates": [
        {
          "sequence": "1",
          "templateId": "12345678-abcd-1234-abcd-1234567890ab"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "1",
          "recipients": {
            "signers": [
              {
                "name": "Test Primary",
                "email": "test@example.com",
                "recipientId": "1",
                "routingOrder": "1",
                "roleName": "RoleOne"
              }
            ]
          }
        }
      ]
    },
    {
      "document": {
        "name": "document2.pdf",
        "documentId": "2"
      },
      "serverTemplates": [
        {
          "sequence": "2",
          "templateId": "abcdef12-1234-abcd-1234-abcdef123456"
        }
      ],
      "inlineTemplates": [
        {
          "sequence": "2",
          "recipients": {
            "signers": [
              {
                "name": "Test Primary",
                "email": "test@example.com",
                "recipientId": "1",
                "routingOrder": "1",
                "roleName": "RoleOne"
              }
            ]
          }
        }
      ]
    }
  ]
}


推荐答案

此示例中的此问题不是继发问题e。

This issue in this example is not the sequence. It is the documentId's for the documents passed in.

创建服务器端模板后,将其视为具有documentId = 1。在这种情况下,将使用两个服务器端模板,每个复合模板部分一个,每个都有documentId = 1。放在这些模板文档上的选项卡与documentId = 1相关联。
为每个组合模板传入的文档的documentId也应为documentId = 1,以便在该文档重叠时,ID匹配。

When a server side template is created, think of it as having documentId=1. In this case, two server side templates are used, one for each composite template section and each has documentId=1. Tabs placed on these template documents are associated with documentId=1. The documentId of the document passed for each composite template in should also be documentId=1 so when that document overlays, the ID matches.

该示例设置了第二个文档作为documentId = 2传递。因此,当信封/模板信息折叠在一起时,选项卡将保留与documentId = 1的关联,因此它们出现在第一个文档的第2页和第7页上,第二个模板被documentId 2覆盖,因此不会有任何选项卡。

The example sets the second document passed in as documentId=2. So, when the envelope/template info is folded together, the tabs retain the association with documentId=1, so they appear on page 2 and page 7 of the first document, The second template is overlaid with documentId 2, so it will not have any tabs.

如果两个复合模板的传入文档都使用documentId = 1,则选项卡将在每个复合模板中正确关联,然后将对documentID进行重新排序

If the passed-in document for both composite templates uses documentId=1, the tabs will properly associate within each composite template, and then the documentID's will be reordered in the final envelope along with tab Id’s.

第一个复合模板中的序列号可以是1,2,3,4或1,2,而1,2

The sequence numbers can be 1,2,3,4 or 1,2 in the first composite template, and 1,2 in the second.

工作示例:

POST http://localhost/restapi/v2/accounts/2/envelopes
X-DocuSign-Authentication: [omitted]
Accept: application/json
Content-Type: multipart/form-data; boundary=70fcb373-f40d-40bb-bddb-204fe789087f
X-DocuSign-ClientTransactionId: T635316112162595227

--70fcb373-f40d-40bb-bddb-204fe789087f
Content-Type: application/json
Content-Disposition: form-data

{
  "compositeTemplates": [
      {
        "compositeTemplateId": "1",
        "serverTemplates": [
          {
            "sequence": "1",
            "templateId": "99B09A06-95AF-47A5-964B-A58E78B981DF"
          }
        ],
        "inlineTemplates": [
          {
            "sequence": "1",
            "recipients": {
              "signers": [
                {
                  "name": "Resty Tester",
                  "email": "resty.tester@gmail.com",
                  "recipientId": "1",
                  "routingOrder": "1",
                  "roleName": "RoleOne"
                }
              ]
            }
          }
        ],
        "document": {
          "documentId": "1",
          "name": "document1In.pdf"
        }
      },
      {
        "compositeTemplateId": "2",
        "serverTemplates": [
          {
            "sequence": "2",
            "templateId": "36FD0433-AAE0-43A7-B795-E06738159A59"
          }
        ],
        "inlineTemplates": [
          {
            "sequence": "2",
            "recipients": {
              "signers": [
                {
                  "name": "Resty Tester",
                  "email": "resty.tester@gmail.com",
                  "recipientId": "1",
                  "routingOrder": "1",
                  "roleName": "RoleOne"
                }
              ]
            }
          }
        ],
        "document": {
          "documentId": "1",
          "name": "document2In.pdf"
        }
      }
    ],
    "status": "created",
    "emailSubject": "Subject PostCompositeTemplate_PLAT_1647_20140328014654",
    "emailBlurb": "Blurb PostCompositeTemplate_PLAT_1647_20140328014654",
    "allowReassign": "false"
  }
  --70fcb373-f40d-40bb-bddb-204fe789087f
  Content-Type: application/pdf
  Content-Disposition: file; filename="document1In.pdf"; documentId=1;             compositeTemplateId="1"
  Content-Transfer-Encoding: base64

  [bytes omitted]
  --70fcb373-f40d-40bb-bddb-204fe789087f
  Content-Type: application/pdf
  Content-Disposition: file; filename="document2In.pdf"; documentId=1; compositeTemplateId="2"
  Content-Transfer-Encoding: base64

  [bytes omitted]
  --70fcb373-f40d-40bb-bddb-204fe789087f--
  201 Created
  Pragma: no-cache
  X-DocuSign-ClientTransactionId: T635316112162595227
  Content-Length: 198
  Cache-Control: no-cache
  Content-Type: application/json; charset=utf-8
  Date: Fri, 28 Mar 2014 20:46:58 GMT
  Expires: -1

  {
    "envelopeId": "5b28e38e-84c0-4af0-a3d0-e3c1e6cee17d",
    "uri": "/envelopes/5b28e38e-84c0-4af0-a3d0-e3c1e6cee17d",
    "statusDateTime": "2014-03-28T20:46:57.4300000Z",
    "status": "created"
  }

这篇关于具有多个复合模板的不正确应用的服务器模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆