将文档上载到现有的Envlope API

时间:2015-09-16 17:44:34

标签: docusignapi

我正在尝试将文档上传到现有的草稿信封。

这是我的要求:

// construct an outgoing XML formatted request body (JSON also accepted)
string requestBody =
  "<envelopeDefinition   xmlns=\"http://www.docusign.com/restapi\">" +
  "<documents>" + 
  "<document>"  +
  "<documentId>" + 50 + "</documentId>" +
  "<name>" + "BigTester.pdf" + "</name>" +
  "<order>" + 50 + "</order>" +
  "<filebytes>" + bytes + "</filebytes>" + 
  "</document>" +
  "</documents>" +
  "</envelopeDefinition>";

以及我回来的地方:

Error code: BadRequest
<errorDetails xmlns="http://www.docusign.com/restapi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <errorCode>NO_DOCUMENT_RECEIVED</errorCode>
  <message>The document element did not contain the encoded document, or there is a problem with the encoding. Bytes for document corresponding to documentId 1234 not found in request. 'documentId=&lt;
x&gt;' possibly missing from Content-Disposition header.</message>
</errorDetails>

1 个答案:

答案 0 :(得分:2)

filebytes替换为documentBase64并添加fileExtension

文档的XML节点示例

  <documents>
    <document>
      <documentBase64>sample string 11</documentBase64>
      <documentFields>
        <nameValue>
          <name>sample string 1</name>
          <value>sample string 2</value>
        </nameValue>
      </documentFields>
      <documentId>sample string 1</documentId>
      <encryptedWithKeyManager>sample string 10</encryptedWithKeyManager>
      <fileExtension>sample string 7</fileExtension>
      <matchBoxes>
        <matchBox>
          <height>5</height>
          <pageNumber>1</pageNumber>
          <width>4</width>
          <xPosition>2</xPosition>
          <yPosition>3</yPosition>
        </matchBox>
      </matchBoxes>
      <name>sample string 4</name>
      <order>sample string 8</order>
      <pages>sample string 9</pages>
      <password>sample string 5</password>
      <remoteUrl>sample string 3</remoteUrl>
      <transformPdfFields>sample string 6</transformPdfFields>
      <uri>sample string 2</uri>
    </document>
  </documents>