将Word文档添加到现有信封时为FORMAT_CONVERSION_ERROR

时间:2017-06-28 02:11:28

标签: docusignapi

我正在构建一个创建DocuSign信封的应用程序,作为其中的一部分,我需要将一些MS Word(docx)文档添加到我之前创建的现有信封中。

我已成功实施了多项DocuSign API调用,包括从PDF和Word文档创建多文档草稿信封的调用。

但是,当我尝试向此信封添加更多文档时,我会收到一个' FORMAT_CONVERSION_ERROR'我添加的每个Word文档的错误。 PDF文档可以成功添加。

我提出的API请求如下:

Method: PUT
URL: https://demo.docusign.net/restapi/v2/accounts/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx/envelopes/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/documents

Request:

Custom Headers
Name
Value
Accept
application/json
Content-Transfer-Encoding
Base64
Content-Type
application/json
X-DocuSign-Authentication
{"SendOnBehalfOf" : "", "Username" : "username_goes_here",     "Password":"password_goes_here","IntegratorKey":"integrator_key_goes_here"}
Body:
"documents": [
    {
      "name": "2016 Audit Engagement Letter - Executive Superannuation     Fund",
      "documentId": "8",
      "fileExtension": "docx",
      "documentBase64": "UEsDBB..."
    },
    {
      "name": "2016 Audit Management Letter - Executive Superannuation Fund",
      "documentId": "9",
      "fileExtension": "docx",
      "documentBase64": "UEsDBBQAB..."
    },
    {
      "name": "2016 Audit Representation Letter - Executive Superannuation Fund",
      "documentId": "10",
      "fileExtension": "docx",
      "documentBase64": "UEsDBBQABgA..."
    },
    {
      "name": "2016 Independent Audit Report - Executive Superannuation Fund",
      "documentId": "11",
      "fileExtension": "docx",
      "documentBase64": "UEsDBBQABgAIA..."
    },
]

我得到200 OK,但身体出现以下错误:

{
  "envelopeId": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
  "envelopeDocuments": [
    {
      "documentId": "8",
      "order": "8",
      "errorDetails": {
        "errorCode": "FORMAT_CONVERSION_ERROR",
        "message": "The data could not be converted."
      }
   },
    {
      "documentId": "9",
      "order": "9",
      "errorDetails": {
        "errorCode": "FORMAT_CONVERSION_ERROR",
        "message": "The data could not be converted."
      }
    },
    {
      "documentId": "10",
      "order": "10",
      "errorDetails": {
        "errorCode": "FORMAT_CONVERSION_ERROR",
        "message": "The data could not be converted."
      }
    },
    {
      "documentId": "11",
      "order": "11",
          "errorDetails": {
            "errorCode": "FORMAT_CONVERSION_ERROR",
            "message": "The data could not be converted."
          }
        }
    ]
    }

可以在创建草稿信封的原始POST请求中成功上传相同的文档,因此我不认为文档和base64编码是问题。

同样,如果我用PDF文档替换文档,请求就可以了,并且PDF会被添加到现有信封中。

有没有人见过这个? DS是否支持将Word文档添加到预先存在的草稿信封中?

干杯, 海登

1 个答案:

答案 0 :(得分:1)

使用文件扩展名指定name属性正在运行。看起来fileExtension属性不必在putDocuments api中单独指定。

  

PUT / v2 / accounts / {accountId} / envelope / {envelopeId} / documents

{
   "documents": [
   {
      "name": "2016 Audit Engagement Letter - Executive Superannuation Fund.docx",
      "documentId": "8",
      "documentBase64": "UEsDBB..."
   },
   {
      "name": "2016 Audit Management Letter - Executive Superannuation Fund.docx",
     "documentId": "9",
     "documentBase64": "UEsDBBQAB..."
   }
  ]
}