Docusign API信封创建未指定错误

时间:2016-07-19 22:31:41

标签: docusignapi

基本上我已经开发出一种可以在Sandbox中运行但不能在生产中使用的解决方案。

{
   "documents":[
      {
         "documentId":"73110157",
         "fileExtension":"pdf",
         "name":"Standard Swell HIC-clean.pdf",
         "documentBase64":"omitted_the_base64_string"
      }
   ],
   "emailSubject":"Standard Swell Home Improvement Contract",
   "recipients":{
      "carbonCopies":[
         {
            "email":"an@email.address",
            "name":"Name",
            "recipientId":"2",
            "routingOrder":"2"
         },
         {
            "email":"an@email.address",
            "name":"Name",
            "recipientId":"3",
            "routingOrder":"3"
         },
         {
            "email":"an@email.address",
            "name":"Name",
            "recipientId":"4",
            "routingOrder":"4"
         }
      ],
      "signers":[
         {
            "email":"myemail@gmail.com",
            "name":"Mic Nuss",
            "recipientId":"1",
            "routingOrder":"1",
            "clientUserId":"an-alpha-numeric-ID",
            "roleName":"Customer",
            "tabs":{
               "dateSignedTabs":[
                  {
                     "anchorString":"signer1date",
                     "anchorYOffset":"-2",
                     "anchorXOffset":"0",
                     "fontSize":"Size10",
                     "name":"Date Signed",
                     "recipientId":"1",
                     "tabLabel":"date_signed",
                     "anchorIgnoreIfNotPresent":"true",
                     "documentId":"73110157"
                  }
               ],
               "fullNameTabs":[
                  {
                     "anchorString":"signer1name",
                     "anchorYOffset":"0",
                     "anchorXOffset":"-10",
                     "fontSize":"Size10",
                     "name":"Full Name",
                     "recipientId":"1",
                     "tabLabel":"Full Name",
                     "anchorIgnoreIfNotPresent":"true",
                     "documentId":"73110157"
                  }
               ],
               "signHereTabs":[
                  {
                     "anchorString":"signer1sig",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-10",
                     "anchorYOffset":"3",
                     "name":"Please sign here",
                     "optional":"false",
                     "recipientId":"1",
                     "scaleValue":1,
                     "tabLabel":"signer1sig",
                     "anchorIgnoreIfNotPresent":"true",
                     "documentId":"73110157"
                  }
               ],
               "initialHereTabs":[
                  {
                     "anchorString":"signer1initials",
                     "anchorUnits":"mms",
                     "anchorXOffset":"13",
                     "anchorYOffset":"10",
                     "name":"Your Initials here",
                     "optional":"false",
                     "recipientId":"1",
                     "scaleValue":1,
                     "tabLabel":"signer1initials",
                     "anchorIgnoreIfNotPresent":"true",
                     "documentId":"73110157"
                  }
               ],
               "textTabs":[
                  {
                     "anchorString":"signer1c_info",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-4",
                     "anchorYOffset":"-2",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Client Info",
                     "shared":"true",
                     "tabLabel":"signer1c_info",
                     "value":"Mic Nuss\n2223834843\nmicaelnussbaumer@gmail.com",
                     "width":"167",
                     "height":"58",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_address",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-4",
                     "anchorYOffset":"-2",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Client Address",
                     "shared":"true",
                     "tabLabel":"signer1c_address",
                     "value":"Rua Frederico Perry Vidal, Lisbon, 7900, Lisbon",
                     "width":"167",
                     "height":"58",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_contractor",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-4",
                     "anchorYOffset":"-2",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Contractor Info",
                     "shared":"true",
                     "tabLabel":"signer1c_contractor",
                     "value":"Solarcity\nfalse",
                     "width":"167",
                     "height":"58",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_epc_license",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-3",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Contractor License",
                     "shared":"true",
                     "tabLabel":"signer1c_epc_license",
                     "value":"888104",
                     "width":"130",
                     "height":"10",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_product",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-2",
                     "anchorYOffset":"0",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Product Name",
                     "shared":"true",
                     "tabLabel":"signer1c_product",
                     "value":"Sonnen Eco 10",
                     "width":"450",
                     "height":"70",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_scope",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-4",
                     "anchorYOffset":"-2",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Scope of Work",
                     "shared":"true",
                     "tabLabel":"signer1c_scope",
                     "value":"",
                     "width":"450",
                     "height":"90",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_total_contract",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Base Price",
                     "shared":"true",
                     "tabLabel":"signer1c_total_contract",
                     "value":"19557.5",
                     "width":"200",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_credits",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Credits",
                     "shared":"true",
                     "tabLabel":"signer1c_credits",
                     "value":"250.0",
                     "width":"200",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_amount_due",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Net Price",
                     "shared":"true",
                     "tabLabel":"signer1c_amount_due",
                     "value":"19307.5",
                     "width":"200",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_amount_owner",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Amount Due from Owner",
                     "shared":"true",
                     "tabLabel":"signer1c_amount_owner",
                     "value":"19307.5",
                     "width":"200",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_amount_financier",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Amount Due from Financier",
                     "shared":"true",
                     "tabLabel":"signer1c_amount_financier",
                     "value":"0",
                     "width":"200",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_financier",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Financier",
                     "shared":"true",
                     "tabLabel":"signer1c_financier",
                     "value":"",
                     "width":"200",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_signing_value",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Down Payment",
                     "shared":"true",
                     "tabLabel":"signer1c_signing_value",
                     "value":"1000.0",
                     "width":"130",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_delivery_value",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Delivery Payment",
                     "shared":"true",
                     "tabLabel":"signer1c_delivery_value",
                     "value":"11584.5",
                     "width":"130",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_install_value",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Installation Payment",
                     "shared":"true",
                     "tabLabel":"signer1c_install_value",
                     "value":"5792.25",
                     "width":"130",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_final_value",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Final Payment",
                     "shared":"true",
                     "tabLabel":"signer1c_final_value",
                     "value":"930.75",
                     "width":"130",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_installation_partner",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Installation Partner Name",
                     "shared":"true",
                     "tabLabel":"signer1c_installation_partner",
                     "value":"Solarcity",
                     "width":"200",
                     "height":"10",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_epc_address",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Installation Partner Address",
                     "shared":"true",
                     "tabLabel":"signer1c_epc_address",
                     "value":"false",
                     "width":"520",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_email_epc",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Installation Partner Email",
                     "shared":"true",
                     "tabLabel":"signer1c_email_epc",
                     "value":"",
                     "width":"200",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_date_in_3",
                     "anchorUnits":"mms",
                     "anchorXOffset":"0",
                     "anchorYOffset":"-2",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Date in 3",
                     "shared":"true",
                     "tabLabel":"signer1c_date_in_3",
                     "value":"2016-07-22",
                     "width":"130",
                     "height":"15",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_kitchen",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-4",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Requested Circuits Kitchen",
                     "shared":"true",
                     "tabLabel":"signer1c_kitchen",
                     "value":"Refrigerator/Freezer;Coffee Machine or Tea Kettle;Microwave",
                     "width":"450",
                     "height":"30",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_utilities",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-4",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Requested Circuits Utilities",
                     "shared":"true",
                     "tabLabel":"signer1c_utilities",
                     "value":"Security System",
                     "width":"450",
                     "height":"30",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_media",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-4",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Requested Circuits Media",
                     "shared":"true",
                     "tabLabel":"signer1c_media",
                     "value":"Television \u0026 Cable/Satellite Box;Internet Router \u0026 WiFi",
                     "width":"370",
                     "height":"30",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_outlets",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-4",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Requested Circuits Outlets",
                     "shared":"true",
                     "tabLabel":"signer1c_outlets",
                     "value":"Kitchen;",
                     "width":"450",
                     "height":"30",
                     "documentId":"73110157"
                  },
                  {
                     "anchorString":"signer1c_lighting",
                     "anchorUnits":"mms",
                     "anchorXOffset":"-4",
                     "anchorYOffset":"-1",
                     "anchorIgnoreIfNotPresent":"true",
                     "locked":"true",
                     "name":"Requested Circuits Lighting",
                     "shared":"true",
                     "tabLabel":"signer1c_lighting",
                     "value":"Kitchen;",
                     "width":"450",
                     "height":"30",
                     "documentId":"73110157"
                  }
               ]
            }
         }
      ]
   },
   "status":"sent"
}

这是正在发送的有效负载。 我尝试过一个更纤薄的文档,只有一个签名的TAB,一个Signer,没有BCC。

我已尝试使用我编码的base64文档(从docusign模板下载后),我尝试通过Docusign获取Docusign base64文档编码,我已下载模板并复制了base64的内容文件,都无济于事。

我尝试从现有模板创建一个信封,没有“文档”键。我已经尝试删除不同的可选字段,但是响应更改的唯一时间是我擦除了一些明确需要的字段,然后我将其作为响应。

所有这些都在Sandbox上完美运行。这些文档最初是在Production中从头开始创建的,但之后我认为可能是由于这一点,而是在API转换说明中提到并将Sandbox中的模板作为JSON下载并直接上传到生产中。

信封正在动态创建,我们基本上登录一个帐户并获取该帐户的模板,然后从我们需要的模板中获取文档base64文件。登录和那部分工作,我们进入帐户,我们能够检索它们,所以标题和凭据正在传递,登录正常。

有效负载也正在发送,我在这里发布的是来自我记录的实际呼叫。

它与嵌入式视图无关,因为它在到达该点之前就已中断。

我得到的回应是:

{
  "errorCode": "UNSPECIFIED_ERROR",
  "message": "Input string was not in a correct format."
}

我也尝试了3种不同的lib,net-http,curb(ruby的curl wrap)和Rest-Client。

我试过没有在标签中设置文档ID以及其他键。

我发布到base_url / v2 / accounts / {accountId} / envelope

任何帮助将不胜感激, 感谢

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::EDIT::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

尝试了一个更简单的请求,只是为了创建一个信封而它仍然不起作用。同样的错误。

这是Docusign Server的日志: (登录,访问权限很好,检索帐户,该帐户的模板,文档和下载文档的工作,只是帖子根本不起作用 - 而在沙箱中确实如此)

POST https://na2.docusign.net:8821/restapi/v2/accounts/15308603/envelopes
Content-Length: 973
Content-Type: application/json
Accept: application/json
Host: na2.docusign.net
User-Agent: Ruby
X-Docusign-Authentication: {"Username":"some@email.com","Password":"[omitted]","IntegratorKey":"[omitted]"}
X-Forwarded-For: 83.132.223.215
X-SecurityProtocol-Version: TLSv1.2
X-SecurityProtocol-CipherSuite: ECDHE-RSA-AES256-GCM-SHA384

{"emailSubject":"DocuSign REST API Quickstart Sample","emailBlurb":"Shows how to create and send an envelope from a document.","recipients":{"signers":[{"email":"myemail@gmail.com","name":"My Name","recipientId":"1","routingOrder":"1"}]},"documents":[{"documentId":"44202387","fileExtension":"pdf","name":"test.pdf","documentBase64":"ew0KICAidGVtcGxhdGVJZCI6ICIxYjZjY2FkMS01ZDFmLTQwM2EtYjRhMC0zZTVkZjU1OThhZTUiLA0KICAidGVtcGxhdGVEb2N1bWVudHMiOiBbDQogICAgew0KICAgICAgImRvY3VtZW50SWQiOiAiNDQyMDIzODciLA0KICAgICAgIm5hbWUiOiAidGVzdC5wZGYiLA0KICAgICAgInR5cGUiOiAiY29udGVudCIsDQogICAgICAidXJpIjogIi90ZW1wbGF0ZXMvMWI2Y2NhZDEtNWQxZi00MDNhLWI0YTAtM2U1ZGY1NTk4YWU1L2RvY3VtZW50cy80NDIwMjM4NyIsDQogICAgICAib3JkZXIiOiAiMSIsDQogICAgICAicGFnZXMiOiAiMSIsDQogICAgICAiYXZhaWxhYmxlRG9jdW1lbnRUeXBlcyI6IFsNCiAgICAgICAgew0KICAgICAgICAgICJ0eXBlIjogImVsZWN0cm9uaWMiLA0KICAgICAgICAgICJpc0RlZmF1bHQiOiAidHJ1ZSINCiAgICAgICAgfQ0KICAgICAgXQ0KICAgIH0NCiAgXQ0KfQ=="}],"status":"sent"}
400 BadRequest
Content-Type: application/json; charset=utf-8

{
  "errorCode": "UNSPECIFIED_ERROR",
  "message": "Input string was not in a correct format."
}

2 个答案:

答案 0 :(得分:1)

错误消息(“输入字符串格式不正确。”)似乎暗示您在请求中指定的字符串值之一在某种程度上无效。也许尝试在以下三个标签中的每一个的属性中转义反斜杠字符(通过指定\\而不仅仅是\)?

  • Requested Circuits Media

  • Client Info

  • Contractor Info

答案 1 :(得分:0)

您是否通过了认证步骤,因此您的integration_key / client_id已升级到生产平台?

您使用https?

调用API

您是否能够成功地更简单地调用生产平台?例如Folders: list

您使用的是哪种身份验证方式? OAuth或Legacy Header还是别的什么?

错误消息的性质表明您应该检查平台API日志。你做到了吗?