【问题标题】:Operation Cannot consume content type is not supported. when trying to upload a file to sandbox-quickbooks.api.intuit.com操作不能使用内容类型不受支持。尝试将文件上传到 sandbox-quickbooks.api.intuit.com 时
【发布时间】:2020-03-07 11:01:29
【问题描述】:

我们正在向 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】:

    /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

    看起来你已经搞混了 - 看起来你正在尝试将一个新文件上传到 existing file 端点。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-28
      • 2020-10-01
      • 2012-05-24
      • 2020-12-01
      • 2019-05-22
      • 1970-01-01
      • 1970-01-01
      • 2019-12-06
      相关资源
      最近更新 更多