如何使用BigCommerce API更新自定义字段? [英] How can I update custom fields using the BigCommerce API?
问题描述
我正在寻求更新产品上的自定义字段.
I am looking to update the custom fields on a product.
API文档建议您不能直接修改广告客户的自定义字段产品,只能访问它们:
The API docs suggest that you can't directly modify the custom fields on a product, only access them:
我的下一个想法是更新产品
这是产品上现有的custom_field.
This is the existing custom_field on the product.
{
"url"=> "https://storename.mybigcommerce.com/api/v2/products/32/customfields.json",
"resource"=>"/products/32/customfields"
}
当我尝试修改url/资源并将哈希发送回更新时,我会被400 Bad Request
:(
When I try to modify the url/resource and send the hash back to update, I am greeted with a 400 Bad Request
:(
new_custom_fields = {
"url" => "https://storename.mybigcommerce.com/api/v2/products/75/customfields.json",
"resource" => "/products/75/customfields"
}
api.update_products(75, {"custom_fields" => new_custom_fields})
RuntimeError: Failed to parse Bigcommerce response: 400 Bad Request
有想法吗?
推荐答案
这似乎是Bigcommerce API中的错误.当前仅支持自定义字段上的GET请求.
this seems to be a bug in the Bigcommerce APIs. Currently only GET requests on the custom fields are supported.
http://developer.bigcommerce.com/api/products/customfields
这可能就是您击中400的原因.
That is probably the reason why you are hitting a 400.
这篇关于如何使用BigCommerce API更新自定义字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!