您的问题表明您将该 JSON 提交到“获取收件人视图”资源:
https://demo.docusign.net/restapi/v2/accounts/ACCOUNT_ID/envelopes/ENVELOPE_ID/views/recipient)
...但是该 JSON 看起来像您在“创建信封”请求中使用的内容,而不是“获取收件人视图”请求中使用的内容。因此,让我首先澄清促进嵌入式/强制签名的过程(即在您的站点内呈现收件人的信封)。这样做分为两步:
STEP 1:创建信封(如果需要,请求包括为每个收件人预填充字段的数据)。
POST https://{server}/restapi/{apiVersion}/accounts/{accountId}/envelopes
请参阅 REST API 指南第 27 页开始的“从模板创建信封”部分(http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf)有关请求和响应的详细信息。
STEP 2:检索可用于启动收件人信封(签名会话)的 URL。
POST https://{server}/restapi/{apiVersion}/accounts/{accountId}/envelopes/{envelopeId}/views/recipient
{
"authenticationMethod":"Email",
"clientUserId":"CLIENT_USERID_SPECIFIED_IN_REQUEST",
"email":"RECIPIENT_EMAIL",
"returnUrl":"URL_TO_REDIRECT_TO_WHEN_SIGNING_COMPLETE",
"userName":"RECIPIENT_NAME"
}
响应将包含可用于启动收件人信封的 URL:
{
"url":"URL_THAT_WILL_LAUNCH_ENVELOPE"
}
请参阅 REST API 指南第 160 页开始的“收件人后视图”部分(http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf)有关请求和响应的更多详细信息。
现在,假设您正确执行了所有这些操作(步骤 1 和步骤 2),那么让我们回到您报告的问题:难以为收件人预填充字段。关于您问题中包含的“从模板创建信封”JSON 的一些评论:
- 你不需要帐户ID在请求中。
- 你不需要包括文档ID and 页码在选项卡的请求中。
- 你需要包括客户端用户ID对于请求中的收件人,如果您希望收件人在您的站点内嵌入/强制签名。
因此,这是一个“从模板创建/发送信封”示例请求(step 1上面),用值“VALUE_A”预先填充名为“FIELD_1”的选项卡,该选项卡出现在信封中的任何位置:
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
"status" : "sent",
"emailBlurb" : "please sign",
"emailSubject" : "Please sign your document",
"templateId" : "TEMPLATE_ID",
"templateRoles" : [{
"name" : "John Doe",
"email" : "[email protected] /cdn-cgi/l/email-protection",
"roleName" : "Signer1Role",
"clientUserId" : "123",
"tabs" :
{"textTabs":[{
"tabLabel":"\\*FIELD_1",
"value":"VALUE_A"}
]}
}]
}
然后,您将获取响应中返回的信封 ID 并调用“获取收件人视图”资源(step 2上面)获取启动签名会话的 URL:
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes/ENVELOPE_ID/views/recipient
{
"authenticationMethod": "Email",
"clientUserId": "123",
"userName": "John Doe",
"email": "Johns[email protected] /cdn-cgi/l/email-protection",
"returnUrl": "http://www.google.com"
}
Finally, one last comment (but an important one): if you're just wanting to inject the recipient's "full name" in the document -- use the "Full Name" tab when creating the Template and DocuSign will automatically inject the recipient's name in place of that tag, anywhere that it appears (instead of you using a Text Tab and having to populate it via the API request). Here's the Full Name tag in the DocuSign UI tagger view:
另一个创建信封示例(带有数据字段属性的屏幕截图):
如果我提交此请求:
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
"emailSubject": "Please sign this",
"emailBlurb": "Please sign...thanks!",
"templateId": "TEMPLATE_ID",
"envelopeIdStamping": "false",
"templateRoles": [
{
"roleName": "Signer1",
"name": "John Doe",
"email": "[email protected] /cdn-cgi/l/email-protection",
"recipientId": "1",
"tabs":{
"textTabs":[
{
"tabLabel":"\\*address",
"value":"123 Main Street"
},
],
}
}
],
"status": "sent"
}
数据字段属性(通过 DocuSign UI 编辑模板时)如下所示:
那么结果就是带有 Label = 的字段address分配给收件人角色的Signer1当签名者查看其信封时,将预先填充值“123 Main Street”。如果这不适合您,我建议您:
- 验证值roleName在 API 请求中exactly与我在之前的屏幕截图中突出显示的收件人值匹配(在我的示例中为“Signer1”)。
- 验证值tabLabel在 API 请求中exactly与我在前面的屏幕截图中突出显示的标签值匹配(在我的示例中为“地址”)。
Note: 值为区分大小写,因此请确保您请求中的值是exact与数据字段标记属性中的值匹配(包括大写/小写)。