当前位置: 首页 > 知识库问答 >
问题:

Docusign-发送信封REST API(POST Multipart/Form-Data)

汝弘深
2023-03-14
{
    "errorCode": "INVALID_CONTENT_TYPE",
    "message": "Content Type specified is not supported. Content-Type for part[0] must be application/json or application/xml"
}
POST /restapi/v2/accounts/****/envelopes HTTP/1.1
Host: demo.docusign.net
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Authorization: Bearer *********
Cache-Control: no-cache
Postman-Token: c0b940e1-4b6c-4848-abd1-ed5c9c712cb5

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name=""

{
  "status": "sent",
  "emailSubject": "Example of one recipient, type signer",
  "documents": [{
    "documentId": "1",
    "name": "contract.pdf",
  }],
  "recipients": {
    "signers": [{
      "name": "Lisa Simpson",
      "email": "lisa@email.com",
      "recipientId": "1",
      "routingOrder": "1",
      "tabs": {
        "signHereTabs": [{
          "xPosition": "150",
          "yPosition": "200",
          "documentId": "1",
          "pageNumber": "1"
        }],
      }
    }]
  }
}
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="file"; filename="Test.pdf"
Content-Type: application/pdf


------WebKitFormBoundary7MA4YWxkTrZu0gW--
  1. 在POSTMAN中是否有一种方法可以指定部件[0]的内容类型?
  2. 部件[0]和部件[1]的密钥名称应该是什么?
  3. 如何在第[1]部分中传递documentid?

我指的是:https://docs.docusign.com/esign/restapi/envelopes/envelopes/create/#examples REST API文档

共有1个答案

微生俊捷
2023-03-14

有关使用多部分表单与多部分/表单-数据的适当的独立工作DocuSign信封,请参见下文-

DocuSign支持案例04093516已结案,并因在关于通过REST API发送信封的文档中错误地提到表单数据而提交了一份Jira罚单。

硬返回和间距是至关重要的。另外,建议您更新电子邮件地址到您的测试Gmail帐户,注意相同的帐户与+可以使用。如果使用邮递员,请确保您使用的是“原始”,而不是表单数据、x-www-form-urlencoded或二进制。见下图:

--AAA
Content-Type: application/json
Content-Disposition: form-data

{
"emailBlurb": "Test for CEFTAF Lab 2 Custom Fields Recipient Fields Document Fields",
"emailSubject": "Test for Dev 201 Lab 2",
"status": "created",
               "notification":{
              "useAccountDefaults":"false",
              "reminders":{
                 "reminderEnabled":"true",
                 "reminderDelay":"2",
                 "reminderFrequency":"2"
              },
              "expirations":{
                 "expireEnabled":"true",
                 "expireAfter":"15",
                 "expireWarn":"1"
              }
              }, 
"compositeTemplates": [{
"inlineTemplates": [{
"sequence": "1",
"customFields": {
    "textCustomFields": [
      {
        "fieldId": "123",
        "name": "MYCustomID",
        "show": "false",
        "required": "false",
        "value": "myId012345"
      }
    ],
    "listCustomFields": [
      {
        "listItems": [
          "elementValue1","elementValue2","elementValue3"
        ],
        "fieldId": "1234",
        "name": "myArrayListofItems",
        "show": "false",
        "required": "false",
        "value": "3"
      }
    ]
  },

"documents": [{
"documentId": "1",
"name": "test1.txt",
      "documentFields": [
        {
          "name": "Test1",
          "value": "value for test1"
        }
      ],
},
            {
"documentId": "2",
"name": "test2.txt"
},
            {
"documentId": "3",
"name": "test3.txt"
}

            ],
"recipients": {
            "carbonCopies": [
                            {
                                "email": "dsproservedemosoapui+Testcc@gmail.com",
                                "name": "David Grigsby (see all document)",
                                "recipientId": "3",
                                "routingOrder": "3"
                            },
                            {
                                "email": "dsproservedemosoapui+Testcc1@gmail.com",
                                "name": "David Grigsby (see all)",
                                "recipientId": "4",
                                "routingOrder": "4"
                            }
                            ],
"signers": [{
"recipientId": "1",
"customFields": [
  "Recip 1 ID 1234"
],
"name": "David Grigsby (Sees all)",
"email": "dsproservedemosoapui+Test1@gmail.com", 
                    "routingOrder": "1",
                    "tabs": {
                    "signHereTabs": [{
                      "anchorString": "Sign1",
                      "tabLabel": "Sign Here 1"
                      }]
                    }
},
                {
"recipientId": "2",
"name": "David Grigsby (sees all )",
"email": "david.grigsby@yahoo.com", 
                    "routingOrder": "2",
                    "tabs": {
                    "signHereTabs": [{
                      "anchorString": "Sign2",
                      "tabLabel": "Sign Here 2"
                      }]
                    }
}
                ]
}
}]
}]
}

--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test1.txt"; documentid=1

Test Document 1 

Sign1 Here _______________________________    Custom1 Approve:



Sign2 Here _______________________________    Custom2 Approve:


--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test2.txt"; documentid=2

Test Document 2

Sign1 Here _______________________________

--AAA
Content-Type: application/txt
Content-Disposition: file; filename="test3.txt"; documentid=3

Test Document 3

No Tabs for anyone means visbile to all by default unless excluded

--AAA--
--AAA
Content-Type: application/pdf
Content-Disposition: file; filename="f4506t.pdf"; documentid=1
Content-Transfer-Encoding: base64

JVBERi0xLjcNJeLjz9MNCjMwMSAwIG9iag08PC9MaW5lYXJpemVkIDEvTCA3NDAzMi9PIDMwMy9F
IDMzNjI2L04gMi9UIDczNjM4L0ggWyA2MzAgMjk2XT4+DWVuZG9iag0gICAgICAgICAgICAgICAg
o4IlmH0CxPYUYWBiYGBUB5PVDADOVQiaCmVuZHN0cmVhbQplbmRvYmoKc3RhcnR4cmVmCjg1MDUz
CiUlRU9GCg==
--AAA--
 类似资料:
  • 我使用信封API得到以下响应 我无法打开信封,即使我已登录到Web中的站点。让我知道打开信封的URL。响应没有给出确切的URL。

  • null 不确定我需要在这里做什么改变?我仍然希望DocuSign中的状态为“已发送”,但不希望DocuSign像他们那样自动发送电子邮件,因为我们将在请求创建后立即发送链接。

  • 我创建了一个包含多个文档的docusign模板。模板声明了3个签名角色。然后,我从该模板创建一个有3个收件人信封。模板和我们的帐户启用了文档可见性,这样签名者只能查看他们必须签名的文档。在信封由所有三个签名完成后,我需要将每个完成的信封的PDF存储在我们站点上不同的收件人帐户下。由于启用了文档可见性,因此不能为所有3个签名者提供一个PDF。这将打破可见性功能,他们将能够看到彼此的私人信息。相反,必

  • 我正在将accesstoken与文档数据一起发送,但收到此错误。我发送单据数据的顺序是否正确

  • 我正在尝试使用本教程发送一个信封请求。我正在使用NodeJS尝试以base64格式硬编码PDFFile,但我得到的是pdf_validation_failed。这是我的代码: 除了multipart中的主体之外,我将fs.readFileSync(documentName)替换为以下内容: 我错过的文件中有任何转换/加密吗?

  • 我如何设置信封上的TTL由受限制收件人签名? 我搜索了并搜索了StackOverflow。令人惊讶的是,我看到了Docusign可以说信封已过期的引用,但我没有看到如何设置信封的过期时间。 在我的测试中,我生成了一堆我寄给自己的信封,但我没有签名。Docusign不断发送有关它们的提醒。现在从信封生成到现在已经2天了。我不想让客户在他们应该签字后很久才收到关于它的电子邮件。 我的意图是将它们从我的