【问题标题】:BigCommerce API Category Update Doesn't WorkBigCommerce API 类别更新不起作用
【发布时间】:2020-07-08 15:30:04
【问题描述】:

我使用此代码提交了 BigCommerce 类别更新:

curl -X PUT  -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Client: <auth client>" -H "X-Auth-Token: <auth token>" -H "X-Custom-Auth-Header: <custom auth header>" -d '{\"data\":{\"id\":2876,\"parent_id\":30,\"name\":\"Health, Fitness & Recreation\",\"description\":\"\",\"views\":0,\"sort_order\":2620,\"page_title\":\"\",\"meta_keywords\":[\"\"],\"meta_description\":\"\",\"layout_file\":\"category.html\",\"image_url\":\"https://catalog.progressivepii.com/Images/eItems/237834_Full.jpg\",\"is_visible\":true,\"search_keywords\":\"\",\"default_product_sort\":\"use_store_settings\",\"custom_url\":{\"url\":\"/furniture-furnishings/health-fitness-recreation/\",\"is_customized\":false}},\"meta\":{}}' "https://api.bigcommerce.com/stores/t4yqg98af9/v3/catalog/categories/2876"

我在通话中没有遇到任何错误。它返回 JSON 响应。但是,响应是 old 值,并没有反映我的更改。这是怎么回事?它应该返回错误或更新我的更改。

兰迪·坎彭 Intellex公司

【问题讨论】:

    标签: bigcommerce


    【解决方案1】:

    这是一个用于更新 Bigcommerce 上的类别的示例 cURL 请求。

    curl --location --request PUT 'https://api.bigcommerce.com/stores/{STORE_HASH}/v2/categories/18' \
    --header 'X-Auth-Token: {ACCESS_TOKEN}' \
    --header 'X-Auth-Client: {CLIENT_ID}' \
    --header 'Accept: application/json' \
    --header 'Content-Type: application/json' \
    --data-raw '{"name": "A Different Category Name"}'
    

    看起来您正在尝试使用 data 对象内的数据进行更新,您还发送了一个 meta 对象,并在请求正文中发送了 id,所有这些都不是正确的。 尝试将其用作请求正文

    {
        "parent_id": 30,
        "name": "Health, Fitness & Recreation",
        "description": "",
        "sort_order": 2620,
        "page_title": "",
        "meta_keywords": "KEYWORDS",
        "meta_description": "",
        "layout_file": "category.html",
        "is_visible": true
      }
    
    

    尝试向以下网址发送PUT 请求:https://api.bigcommerce.com/stores/{STORE_HASH}/v2/categories/2876

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多