服务器端模板已替换为上载的文档 [英] Server side template is replaced with uploaded document

查看:35
本文介绍了服务器端模板已替换为上载的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用两个服务器端模板和我在一个请求中全部生成的pdf文档创建用于嵌入式签名的信封。服务器端模板之一具有DOB选项卡,该选项卡将使用请求中指定的数据填充。

I'm am trying to create an envelope for embedded signing with two sever-side templates and a pdf document I generated all in one request. One of the server-side templates has a DOB tab that will be filled in with the data specified in the request.

我用文档此处此处我已经使用这些示例来格式化我的请求。

I've reviewed some other questions related to the docusign api and composite templates with documents here and here I've used these examples to format my request.

这里是请求:注意:我正在使用在此处的multipart-post宝石中创建请求,因此该请求中的一部分是伪HTTP,带有一些多篇文章信息。我不确定如何获取完整的HTTP请求以将其发布到此处。

Here is the request: NOTE: I'm using the multipart-post gem here to create the request, so some of this request is pseudo HTTP with some multipart-post info. I'm not sure how to get a fully formed HTTP request out in order to post it here.

POST http://localhost/restapi/v2/accounts/2/envelopes
X-DocuSign-Authentication: [omitted]

-------------RubyMultipartPost
Content-Type: application/json
Content-Disposition: form-data;
name="post_body"
{
"compositeTemplates": [
    {
        "serverTemplates": [
            {
                "sequence": 1,
                "templateId": "3093E017-2E18-4A30-A104-0201C601CE5F"
            }
        ],
        "inlineTemplates": [
            {
                "sequence": 1,
                "recipients": {
                    "signers": [
                        {
                            "email": "jond@gmail.com",
                            "name": "Jon D. Doe",
                            "recipientId": "1",
                            "roleName": "Proposed Insured",
                            "clientUserId": "jond@gmail.com",
                            "tabs": {
                                "textTabs": [

                                ],
                                "checkboxTabs": [

                                ],
                                "fullNameTabs": [

                                ],
                                "dateTabs": [
                                    {
                                        "tabLabel": "DOB",
                                        "name": null,
                                        "value": "1-21-1974",
                                        "documentId": null,
                                        "selected": null
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        ],
        "document": {
            "documentId": "1",
            "name": "test.pdf"
        }
    },
    {
        "serverTemplates": [
            {
                "sequence": 2,
                "templateId": "63CA2E24-BBB8-499F-A884-021580DF54AF"
            }
        ],
        "inlineTemplates": [
            {
                "sequence": 2,
                "recipients": {
                    "signers": [
                        {
                            "email": "jond@gmail.com",
                            "name": "Jon D. Doe",
                            "recipientId": "1",
                            "roleName": "Proposed Insured",
                            "clientUserId": "jond@gmail.com",
                            "tabs": {
                                "textTabs": [

                                ],
                                "checkboxTabs": [

                                ],
                                "fullNameTabs": [

                                ],
                                "dateTabs": [
                                    {
                                        "tabLabel": "DOB",
                                        "name": null,
                                        "value": "1-21-1974",
                                        "documentId": null,
                                        "selected": null
                                    }
                                ]
                            }
                        }
                    ]
                }
            }
        ]
    }
],
"status": "sent"
}
-------------RubyMultipartPost
Content-Disposition: file;filename="test.pdf";documentid=1;name="file1"
Content-Length: 34967
Content-Type: application/pdf
Content-Transfer-Encoding: binary

[pdf bytes omitted]

生成的嵌入式视图只有两个文件中。第一个是我在请求中上传的test.pdf,第二个是由templateId = 63CA2E24-BBB8-499F-A884-021580DF54AF

The resulting embedded view only has two documents in it. The 1st is the test.pdf I uploaded in the request and the 2nd is the server-side template specified by templateId=63CA2E24-BBB8-499F-A884-021580DF54AF

I指定的服务器端模板我不确定我在做什么错..根据我上面提到的其他问题,这应该可以工作。

I'm not sure what I'm doing wrong .. according to the other questions I referenced above, this should work.

推荐答案

每个 compositeTemplate 对象只能提供来自单一来源的文件-如果 compositeTemplate 对象指定一个文档,然后将其视为该 compositeTemplate 对象的文档源。在这种情况下,所有恰好属于同一 compositeTemplate 对象中 serverTemplate 的一部分的文档都将被忽略。

Each compositeTemplate object can only supply files from a single source -- and if a compositeTemplate object specifies a document, then that's considered the document source for that compositeTemplate object. In that case, any documents that happen to be part of a serverTemplate within the same compositeTemplate object will be ignored. This seems to be what you're experiencing.

您发布的请求仅包含两个 compositeTemplate 对象,因此生成的信封仅包含来自两个文档来源:

The request you posted only contains two compositeTemplate objects, so the resulting Envelope only contains documents from two document sources:


  • 第一个 compositeTemplate 中指定的文档 >对象。

第二个 compositeTemplate 对象中指定的serverTemplate中包含的文件。

The file(s) contained in the serverTemplate that's specified in the second compositeTemplate object.

如果您希望信封还包含serverTemplate 3093E017-2E18-4A30-中包含的文件A104-0201C601CE5F ,则需要向请求中添加第三个 compositeTemplate 对象,该对象指定 3093E017-2E18-4A30-A104-0201C601CE5F 作为服务器模板,并使用 inlineTemplate 信息提供必要的收件人和标签信息(与其他 compositeTemplate 您发布的请求中的对象)。 [请参见下面的完整请求示例。]

If you want the Envelope to also contain the file(s) contained in serverTemplate 3093E017-2E18-4A30-A104-0201C601CE5F, you'll need to add a third compositeTemplate object to the request that specifies 3093E017-2E18-4A30-A104-0201C601CE5F as the server template, and uses the inlineTemplate info to provide necessary recipient and tab information (as you've done with the other compositeTemplate objects in the request you posted). [See below for full request example.]

最后,请注意,每个 compositeTemplate sequence 属性的值>对象指定 serverTemplates inlineTemplates 在该特定CompositeTemplate范围内的应用顺序 –它不会影响信封中的文档顺序。请求JSON / XML本身中 compositeTemplate 对象的顺序决定了结果信封中文档的顺序。

Finally, note that the value of the sequence properties within each compositeTemplate object specify the order in which the serverTemplates and inlineTemplates will be applied within the scope of that specific compositeTemplate -- it does nothing to influence the sequence of documents in the Envelope. It's the order of the compositeTemplate objects in the request JSON/XML itself that determines sequence of documents in the resulting Envelope.

以下请求将导致包含以下文件(按此顺序)的信封:

The following request will result in an Envelope that contains the following files (in this order):


  1. 模板 3093E017-2E18-中的文件4A30-A104-0201C601CE5F

  2. 请求指定的文档(documentId = 1)

  3. 模板中的文件 63CA2E24-BBB8-499F-A884-021580DF54AF

  1. Files from template 3093E017-2E18-4A30-A104-0201C601CE5F
  2. The document that's specified by the request (documentId=1)
  3. Files from template 63CA2E24-BBB8-499F-A884-021580DF54AF

请求正文( JSON部分):

{
    "compositeTemplates": [
        {
            "serverTemplates": [
                {
                    "sequence": 1,
                    "templateId": "3093E017-2E18-4A30-A104-0201C601CE5F"
                }
            ],
            "inlineTemplates": [
                {
                    "sequence": 2,
                    "recipients": {
                        "signers": [
                            {
                                "email": "jond@gmail.com",
                                "name": "Jon D. Doe",
                                "recipientId": "1",
                                "roleName": "Proposed Insured",
                                "clientUserId": "jond@gmail.com",
                                "tabs": {
                                    "dateTabs": [
                                        {
                                            "tabLabel": "DOB",
                                            "name": null,
                                            "value": "1-21-1974",
                                            "documentId": null,
                                            "selected": null
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ]
        },
        {
            "serverTemplates": [
                {
                    "sequence": 1,
                    "templateId": "3093E017-2E18-4A30-A104-0201C601CE5F"
                }
            ],
            "inlineTemplates": [
                {
                    "sequence": 2,
                    "recipients": {
                        "signers": [
                            {
                                "email": "jond@gmail.com",
                                "name": "Jon D. Doe",
                                "recipientId": "1",
                                "roleName": "Proposed Insured",
                                "clientUserId": "jond@gmail.com",
                                "tabs": {
                                    "dateTabs": [
                                        {
                                            "tabLabel": "DOB",
                                            "name": null,
                                            "value": "1-21-1974",
                                            "documentId": null,
                                            "selected": null
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ],
            "document": {
                "documentId": "1",
                "name": "test.pdf"
            }
        },
        {
            "serverTemplates": [
                {
                    "sequence": 1,
                    "templateId": "63CA2E24-BBB8-499F-A884-021580DF54AF"
                }
            ],
            "inlineTemplates": [
                {
                    "sequence": 2,
                    "recipients": {
                        "signers": [
                            {
                                "email": "jond@gmail.com",
                                "name": "Jon D. Doe",
                                "recipientId": "1",
                                "roleName": "Proposed Insured",
                                "clientUserId": "jond@gmail.com",
                                "tabs": {
                                    "dateTabs": [
                                        {
                                            "tabLabel": "DOB",
                                            "name": null,
                                            "value": "1-21-1974",
                                            "documentId": null,
                                            "selected": null
                                        }
                                    ]
                                }
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "status": "sent"
}

这篇关于服务器端模板已替换为上载的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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