Bigcommerce API:创建产品图片时获得null返回

时间:2014-04-23 00:21:29

标签: php curl bigcommerce

我使用Bigcommerce PHP Api类构建了一个PHP脚本,到目前为止一切都很好。我可以创建/获取产品,类别,品牌等...但是我现在正在尝试向产品发送添加图像的请求,但是从curl post请求获得空回复。我的图像位于外部服务器上,因此“image_file”字段值设置为图像的完整URL。我的要求如下:

[23-04-2014 01:09:51] https://{my_store_url}/api/v2/products/{product id}/images - Request:
stdClass Object
(
    [image_file] => {my external domain}/{file path}.png
)

我已经检查过,图片网址确实有效,我实际上通过BC控制面板从这个外部网址手动添加了图片,这也很有效。

有什么想法吗?看起来像Bigcommerce API的错误...

提前致谢

1 个答案:

答案 0 :(得分:1)

遗憾的是,图片是只读属性。

Per:https://developer.bigcommerce.com/api/stores/v2/products#create-product

POST / stores / {store_hash} / v2 / products

只读属性 产品的以下属性是只读的。如果请求中包含一个或多个这些属性,则会被拒绝。

calculated_price 牌 图片 discount_rules configurable_fields custom_fields 视频 单品 规则 option_set 选项 tax_class 要求