我无法使用文件 API 上传文件
我在 POSTMAN 和 Curl 中尝试了这个 HTTP 请求,但没有成功,并且两者的结果相同: 将文件(图片)附加到对话中
您能否分享一个来自 Postman 的真实工作示例,或者从 Postman 转换为我可以导入的 Curl 代码片段?
以下返回“设置了错误的 Content-Disposition 标头”
POST /rest/v2/fileapi HTTP/1.1
Host: circuitsandbox.net
Authorization: Bearer MyTokenCodeGoesHere
Content-Length: 100
Content-Disposition: attachment; filename="test.txt"
Cache-Control: no-cache
MyBinaryCodeGoesHere
上面在 curl 中看起来像这样:
curl --location --request POST "https://circuitsandbox.net/rest/v2/fileapi" \
--header "Authorization: Bearer MyTokenCodeGoesHere" \
--header "Content-Length: 100" \
--header "Content-Disposition: attachment; filename=\"test.txt\"" \
--header "Cache-Control: no-cache" \
--header "MyBinaryCodeGoesHere: "
用Host: local.circuit.com
代替 进行测试Host: circuitsandbox.net
,没有连接,我认为这只是一个例子,但为了以防万一。
预期的:
{"fileId":"fb211fd6-df53-4b82-824d-986dac47b3e7","attachmentId":"ZmIyMT..."}
实际结果:
“设置了错误的 Content-Disposition 标头”