我正在尝试使用endpoint以编程方式将标签添加到模板
POST /v2/accounts/{accountId}/templates/{templateId}/recipients/{recipientId}/tabs
我可以可靠地放置checkboxTabs
,dateSignedTabs
,signHereTabs
和initialHereTabs
,但是当涉及放置textTabs
(最重要的)时,我可以使用API Explorer时似乎无法控制尺寸。
我输入高度和宽度参数
但是请求变为
{
"textTabs": [
{
"documentId": "1",
"locked": "true",
"pageNumber": "1",
"required": "false",
"tabLabel": "dataLabel",
"xPosition": "200",
"yPosition": "200"
}
]
}
回复为
{
"textTabs": [
{
"isPaymentAmount": "false",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"required": "false",
"locked": "true",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "dataLabel",
"font": "arial",
"bold": "false",
"italic": "false",
"underline": "false",
"fontColor": "black",
"fontSize": "size7",
"documentId": "1",
"recipientId": "XXXXXX",
"pageNumber": "1",
"xPosition": "200",
"yPosition": "200",
"tabId": "e940cc97-a68c-4da6-9ffe-487439579bc6"
}
]
}
并在页面上呈现为一个很小的文本框。
1)这是API Explorer的限制吗?
2)还是从此端点创建选项卡时,高度和宽度不是有效的选项吗? 2.a),如果是,正确的方法是什么?
答案 0 :(得分:1)
api资源管理器绝对是一个问题:如果您接受查询,它会为您提供并使用所需参数手动提交:
{
"textTabs": [
{
"documentId": "1",
"locked": "true",
"pageNumber": "1",
"required": "false",
"tabLabel": "dataLabel",
"height": "11",
"width": "400",
"xPosition": "200",
"yPosition": "200"
}
]
}
您将能够设置height
和width
!
现在Docusign可能会因为您的人脑无法理解的原因而改变它们。 400 !== 396 in the response
,但请放心,希望这只是过程的一部分。并让自己感到幸运,至少API Explorer的那个页面可以正常工作,unlike some endpoints直达don't have documentation!
还有一个使用python sdk的示例实现:(以防无法读取autogenerated code的情况)
tabs = {
"checkboxTabs": [
{
"documentId": "1",
"locked": "true",
"pageNumber": "1",
"tabLabel": "check1",
"xPosition": "100",
"yPosition": "100"
}
],
"dateSignedTabs": [
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "300",
"yPosition": "100"
}
],
"signHereTabs": [
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "200",
"yPosition": "200"
}
],
"initialHereTabs": [
{
"documentId": "1",
"pageNumber": "1",
"xPosition": "300",
"yPosition": "200"
}
],
"textTabs": [
{
"pageNumber": "1",
"xPosition": "50",
"yPosition": "50",
"tabLabel": "text1",
"locked": "true",
"required": "false",
"documentId": "1",
"height": "11",
"width": "400"
}
]
}
response = Template.template_api.create_tabs(recipient_id=recipient_id, template_id=template_id, account_id=Template.accountID, template_tabs=tabs).to_dict()