以下是用于创建带有预填充和可编辑选项卡的信封实例的代码:
def make_new_envelope(template_id, account_id):
data = json.dumps({
"templateId": "<template_id>",
"status": "sent",
"templateRoles": [
{
"clientUserId": "<any string of your choosing>", # required but determined by you
"email": "test@test.com",
"name": "Maggie Nelson",
"roleName": "signer",
"tabs": {
"textTabs": [
{
"tabLabel": "Text a494f42f-654e-49e1-9add-dd87bdc0dd04",
"fontSize": "size9",
"fontColor": "black",
"font": "lucidaconsole",
"required": "true",
"locked": "false",
"value": "home phone number",
"maxLength": 4000,
"width": 84,
"height": 27,
"documentId": "1",
"recipientId": "1",
"pageNumber": 1,
"tabId": "d94dd078-c808-4ced-a1b1-d3d1a577bca0",
"tabType": "text",
"xPosition": 232,
"yPosition": 343,
}
]
}
}
]
})
envelope_url = "/v2.1/accounts/{account_id}/envelopes".format(account_id=account_id)
x = requests.post(url=BASE_URL + envelope_url, headers=headers, data=data)
return x.json()['envelopeId']
除了选项"locked": "false" 之外,我不肯定所有这些都必须包含在描述选项卡的 json 对象中。
tabLabel 和 tabId 值与模板的已定义选项卡无关。似乎可以将它们设置为您想要的任何值。
关于更新已经创建的信封上的标签...我还没有成功。我会注意到这里详述的错误似乎仍然存在Calling EnvelopesApi#update_document_tabs returns an error