我可以使用docusign中的API修改模板的选项卡

时间:2014-04-14 04:47:58

标签: docusignapi

阅读API文档,我知道我可以编辑创建/发送信封的收件人选项卡

但是,我正在尝试使用undertsand我还可以修改模板的标签吗?

当我使用相同的请求时,如下所示,我收到错误

任何参考都是可以理解的。

我的问题的原因是,每当我更新Feed文档进行一些更正时,我必须重做在其上创建字段。相反,如果我可以通过API发送字段,这将节省我很多时间

谢谢

更新TABS时尝试JSON(尝试添加标签)

{
  "signers": [
    {
      "tabs": {
        "fullNameTabs": [
          {
            "name": "Full Name",
            "tabLabel": "Full Name",
            "bold": "false",
            "italic": "false",
            "underline": "false",
            "documentId": "1",
            "recipientId": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
            "pageNumber": "1",
            "xPosition": "321",
            "yPosition": "676",
            "tabId": "82be754a-47c6-47fc-9793-6fdec6758060"
          }
        ],
        "dateSignedTabs": [
          {
            "name": "Date Signed",
            "value": "",
            "tabLabel": "Date Signed",
            "bold": "false",
            "italic": "false",
            "underline": "false",
            "documentId": "1",
            "recipientId": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
            "pageNumber": "1",
            "xPosition": "504",
            "yPosition": "676",
            "tabId": "1e3f16e8-77a9-4726-9876-66e6d377a0c1"
          }
        ]
      },
      "signInEachLocation": "false",
      "name": "",
      "email": "",
      "recipientId": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
      "recipientIdGuid": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
      "requireIdLookup": "false",
      "routingOrder": "1",
      "roleName": "ONE",
      "status": "created",
      "templateLocked": "false",
      "templateRequired": "false",
      "emailNotification": {
        "emailSubject": "Subject",
        "emailBody": "Body",
        "supportedLanguage": "en"
      }
    },
    {
      "tabs": {
        "signHereTabs": [
          {
            "name": "Sign Here",
            "tabLabel": "Signature 3",
            "scaleValue": 0.9,
            "optional": "false",
            "documentId": "1",
            "recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
            "pageNumber": "1",
            "xPosition": "106",
            "yPosition": "591",
            "tabId": "9b20f825-f37c-4dc6-aa57-d29b3d531d6b"
          }
        ],
        "fullNameTabs": [
          {
            "name": "Full Name",
            "tabLabel": "Full Name",
            "bold": "false",
            "italic": "false",
            "underline": "false",
            "documentId": "1",
            "recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
            "pageNumber": "1",
            "xPosition": "319",
            "yPosition": "622",
            "tabId": "79c35daf-cada-4a57-ac82-8a2a149839e8"
          }
        ],
        "dateSignedTabs": [
          {
            "name": "Date Signed",
            "value": "",
            "tabLabel": "Date Signed",
            "bold": "false",
            "italic": "false",
            "underline": "false",
            "documentId": "1",
            "recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
            "pageNumber": "1",
            "xPosition": "504",
            "yPosition": "622",
            "tabId": "14d47f01-a911-49b9-bf04-1c4cadb2924a"
          }
        ]
      },
      "signInEachLocation": "false",
      "name": "",
      "email": "",
      "recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
      "recipientIdGuid": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
      "requireIdLookup": "false",
      "routingOrder": "2",
      "roleName": "TWO",
      "status": "created",
      "templateLocked": "false",
      "templateRequired": "false",
      "emailNotification": {
        "emailSubject": "Subject",
        "emailBody": "Body",
        "supportedLanguage": "en"
      }
    },
    {
      "tabs": {
        "approveTabs": [
          {
            "buttonText": "Approve",
            "width": 60,
            "height": 18,
            "tabLabel": "Approve 9",
            "font": "lucidaconsole",
            "bold": "false",
            "italic": "false",
            "underline": "false",
            "fontSize": "size9",
            "documentId": "1",
            "recipientId": "95f1d73e-df27-4f19-86ea-c921f0321d26",
            "pageNumber": "1",
            "xPosition": "228",
            "yPosition": "718",
            "tabId": "5083943e-bdf0-42fe-87ff-d92778b13be7"
          }
        ],
        "declineTabs": [
          {
            "buttonText": "Decline",
            "width": 60,
            "height": 18,
            "declineReason": "",
            "tabLabel": "Decline 10",
            "font": "lucidaconsole",
            "bold": "false",
            "italic": "false",
            "underline": "false",
            "fontSize": "size9",
            "documentId": "1",
            "recipientId": "95f1d73e-df27-4f19-86ea-c921f0321d26",
            "pageNumber": "1",
            "xPosition": "350",
            "yPosition": "718",
            "tabId": "b1c1ad78-e3b9-4630-b411-09127997f7dd"
          }
        ]
      },
      "signInEachLocation": "false",
      "name": "",
      "email": "",
      "recipientId": "95f1d73e-df27-4f19-86ea-c921f0321d26",
      "recipientIdGuid": "95f1d73e-df27-4f19-86ea-c921f0321d26",
      "requireIdLookup": "false",
      "routingOrder": "3",
      "roleName": "THREE",
      "status": "created",
      "templateLocked": "false",
      "templateRequired": "false",
      "emailNotification": {
        "emailSubject": "Subject",
        "emailBody": "Body",
        "supportedLanguage": "en"
      }
    }
  ],
  "agents": [],
  "editors": [],
  "intermediaries": [
    {
      "name": "",
      "email": "",
      "recipientId": "fa2bffdb-81d7-4de4-a964-e543e2d1d3cf",
      "recipientIdGuid": "fa2bffdb-81d7-4de4-a964-e543e2d1d3cf",
      "requireIdLookup": "false",
      "routingOrder": "3",
      "roleName": "FOUR",
      "status": "created",
      "templateLocked": "false",
      "templateRequired": "false",
      "emailNotification": {
        "emailSubject": "Subject",
        "emailBody": "Body",
        "supportedLanguage": "en"
      }
    }
  ],
  "carbonCopies": [],
  "certifiedDeliveries": [],
  "inPersonSigners": [],
  "recipientCount": "5"
}

网址(尝试POST / PUT)

https://DOMAIN/restapi/v2/accounts/ACCTID/envelopes/ENVELOPID/recipients

RESPONSE

{
  "errorCode": "ENVELOPE_CANNOT_CORRECT_INVALID_STATE",
  "message": "This account may not have 'correct' permission, or the envelope state is not 'sent' or 'delivered'."
}

1 个答案:

答案 0 :(得分:2)

我不相信可以使用API​​修改模板本身的选项卡。您尝试使用的“修改或更正收件人信息”操作允许您“修改草稿信封中的收件人”或更正处理中信封的收件人信息。 (来自REST API指南的第156页:https://08d1d92f490618f41c65-8fb00e97ac499a7066a18ce9c66b019b.ssl.cf2.rackcdn.com/REST_API_Guide_v2.pdf)。由于模板既不是草稿信封也不是进程中信封,我不希望此操作适用于修改模板中的标记。

如果您想使用模板指定文档,然后在每次发送信封时通过“创建信封”API调用指定字段,您可以通过使用我在下面描述的技术来实现此目的。 (如果您在Create Envelope API调用中使用“复合模板”,也可以应用相同的技术。)

例如,假设我已经通过DocuSign UI创建了一个模板,该UI具有单个收件人(Signer1)且文档中没有标签。然后,我可以使用以下请求创建一个信封,其中包含模板定义的文档和收件人,以及我的API请求指定的标记(在此示例中,只是一个文本选项卡) :

POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes

{
  "emailSubject": "Please sign this",
  "emailBlurb": "Please sign...thanks!",
  "templateId": "TEMPLATE_ID",
  "templateRoles": [
   {
      "roleName": "Signer1",
      "name": "John Doe",
      "email": "johnsemail@outlook.com",
      "recipientId": "1",
      "tabs":{
            "textTabs":[
               {
                 "documentId": "1",
                 "pageNumber": "1",
                 "recipientId": "1",
                 "xPosition": "100",
                 "yPosition": "400",
                 "tabLabel":"Address",
                 "name":"Address",
                 "value":"123 Main Street",
                 "locked": "false"
               },
            ],
         }
    }
  ],
  "status": "sent"
}

上面的示例使用“创建信封”请求中的 templateRoles 。如果您在“创建信封”请求中使用复合模板,请求正文将如下所示:

POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
    "emailSubject": "Please sign",
    "emailBlurb": "Please sign...thanks!",
    "status": "sent",
    "compositeTemplates": [{
        "serverTemplates": [{
            "sequence": 1,
            "templateId": "TEMPLATE_ID"
        }],
        "inlineTemplates": [{
            "sequence": 2,
            "recipients": {
                "signers": [{
                    "email": "sallysemail@outlook.com",
                    "name": "Sally Adamson",
                    "recipientId": "1",
                    "roleName": "Signer1",
                     "tabs":{
                        "textTabs":[
                           {
                             "documentId": "1",
                             "pageNumber": "1",
                             "recipientId": "1",
                             "xPosition": "100",
                             "yPosition": "400",
                             "tabLabel":"Address",
                             "name":"Address",
                             "value":"123 Main Street",
                             "locked": "false"
                           },
                        ],
                     }
                }]
            }
        }]
    }]
}

如果您要实施此方法,我建议您考虑使用指定标记放置的“锚文本”技术,而不是为每个标记指定x-y坐标。使用“锚文本”放置技术意味着您指定每个标记相对于文档中某些现有文本的位置,以便标记位置始终正确,即使文档格式稍有变化 - 只要因为锚文本字符串仍然存在于doc中,因此可用于放置标记。有关使用锚文本指定标记放置的详细信息,请参阅REST API指南的第324-325页。