不支持无法操作内容类型的操作。尝试将文件上传到sandbox-quickbooks.api.intuit.com

问题描述 投票:-1回答:1

我们正在向sandbox-quickbooks.api.intuit.com/v3/company/{realm_id}/attachable

带有标题:

Content-Type: multipart/form-data; boundary="--fdlkjflksd--"

和正文:

--fdlkjflksd--
Content-Disposition: form-data; name="file_metadata_01"; filename="attachment.json"
Content-Type: application/json; charset=UTF-8
Content-Transfer-Encoding: 8bit
{"AttachableRef": [{"EntityRef": {"type": "Purchase", "value": "144"}}], "FileName": "one_pixel.jpeg", "ContentType": "image/jpeg"}
--fdlkjflksd--
Content-Disposition: form-data; name="file_content_01"; filename="one_pixel.jpeg"
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
/9j/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAEBAREA/8QAFAABAAAAAAAAAAAAAAAAAAAAA//EABQQAQAAAAAAAAAAAAAAAAAAAAD/2gAIAQEAAD8AN//Z
--fdlkjflksd--

我们正在回应:

{"Fault":{"Error":[{"Message":"Unsupported Operation","Detail":"Operation Cannot consume content type is not supported.","code":"500"}],"type":"ValidationFault"},"time":"2020-03-07T03:00:51.600-08:00"}

我们关注了this example

quickbooks quickbooks-online intuit
1个回答
0
投票

/attachable端点用于链接现有附件到对象,而Content-Type是:

  • application/json

文档在这里:https://developer.intuit.com/app/developer/qbo/docs/develop/tutorials/attach-images-and-notes#attaching-a-note-to-an-object

/upload终结点用于上传新附件Content-Type是:

  • multipart/form-data

文档:https://developer.intuit.com/app/developer/qbo/docs/develop/tutorials/attach-images-and-notes#uploading-files-to-the-attachment-list

[您似乎混在一起,然后向上-好像您正在尝试将新文件上传到现有文件端点。

© www.soinside.com 2019 - 2024. All rights reserved.