DocuSign API 多部分消息不支持内容类型

DocuSign API Content Type not supported in multipart message

我在请求将文档添加到草稿信封时收到 Content Type specified is not supported. Content-Type for part[0] must be application/json or application/xml。据我所知,一切看起来都与他们在文档中的示例完全一样。但我一直收到这个错误。也许你能帮忙?这是我的完整请求。

PUT /restapi/v2/accounts/<int>/envelopes/<string>/documents HTTP/1.1
Host: demo.docusign.net
Accept: application/json
X-DocuSign-Authentication: <personal information excluded>
Content-Type: multipart/form-data; boundary=AAA
Content-Length: 23661

--AAA
Content-Type: application/json
Content-Disposition: form-data
{"documents":[{"documentId":"contract-8","name":"contract-8.pdf","order":0}]}
--AAA
Content-Type: application/pdf
Content-Disposition: file; filename="contract-8.pdf"; documentId="contract-8"

<bits for PDF removed>

--AAA--

我正在按照文档 here. And I'm building the request using cURL in PHP. I'm pretty confident the issue isn't there, but if you're curious I've been building my own library here 将其用于我的项目。

再次感谢。

您需要在 MIME headers 之后换行,因此在 Content-Disposition: form-data 和 json.[=10= 的 { 之间添加一个空行]