Bigcommerce v3 API抛出错误"值已经用于此选项"

时间:2018-01-30 06:24:02

标签: api bigcommerce

我想使用Bigcommerce v3 API创建包含其变体的产品。我作为参数传递的json如下:

{
  "name": "Western Blotting Boxes",
  "type": "physical",
  "price": "16.0",
  "description": "7.3 x 3 x 1.9cm",
  "weight": 0,
  "width": 7,
  "height": 4,
  "depth": 4,
  "page_title": "",
  "meta_keywords": [],
  "meta_description": "",
  "fixed_cost_shipping_price": 0,
  "inventory_tracking": "variant",
  "inventory_level": 100,
  "brand_id": 38,
  "categories": [
    25,
    24
  ],
  "variants": [
    {
      "cost_price": "28.2",
      "price": "47.0",
      "sku": "B1200-15",
      "inventory_level": 1000000000,
      "option_values": [
        {
          "option_display_name": "Size",
          "label": "4 9/16 x 4 9/16 x 1 1/4in. "
        },
        {
          "option_display_name": "Box Color",
          "label": "Clear"
        }
      ]
    },
    {
      "cost_price": "30.0",
      "price": "50.0",
      "sku": "B1200-15BK",
      "inventory_level": 1000000000,
      "option_values": [
        {
          "option_display_name": "Size",
          "label": "4 9/16 x 4 9/16 x 1 1/4in."
        },
        {
          "option_display_name": "Box Color",
          "label": "Opaque Black"
        }
      ]
    }
  ]
}

当我发送创建产品的请求时,我收到错误

选项标签:" 4 9/16 x 4 9/16 x 1 1/4英寸。已在此选项上使用该值。

我如何处理此错误?

1 个答案:

答案 0 :(得分:1)

尝试删除第一个"label": "4 9/16 x 4 9/16 x 1 1/4in. "

实例中句点与双引号之间的额外空格

当我测试时,删除空间允许请求通过。

对此问题的回复也发布在BigCommerce社区: https://forum.bigcommerce.com/s/feed/0D51B000048NMlOSAW?t=1517344095731