【问题标题】:PUT method not post data ShopifyAPIPUT 方法不发布数据 ShopifyAPI
【发布时间】:2013-02-06 06:02:01
【问题描述】:

我正在使用使用 CURL 的 ShopifyAPI,我分别使用 POST 和 DELETE 方法集成了用于创建产品和删除产品的 API,但是当我使用 PUT 方法修改产品时,如下所述

curl -i  -H "Content-Type: application/json" -H "Accept: application/json" -X PUT -d '{"product":{"title":"sadasasdasdasasd","vendor":"Test Drobe","body_html":"testtest<\/p>","product_type":"Health & Fitness","variants":{"price":"250","inventory_management":"shopify","inventory_policy":"continue","requires_shipping":true,"taxable":true,"fulfillment_service":"manual","title":"1"},"id":"120393158"}}' https://xxxxxxxxxxxxxxxxxxx:xxxxxxxxxxx@myshop.myshopify.com/admin/products/120393158.json

我的输出低于输出

HTTP/1.1 500 Internal Server Error
Server: nginx
Date: Wed, 06 Feb 2013 05:52:34 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 500 Internal Server Error
X-Shopify-Shop-Api-Call-Limit: 3/500
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 3/500
Cache-Control: no-cache
X-Request-Id: e3942aa30d0979a09d6e155ea5b837cd
X-UA-Compatible: IE=Edge,chrome=1
Set-Cookie: _secure_session_id=3bf98f1b3303d585a2af7aac5c0a1107; path=/; secure; HttpOnly
X-Runtime: 0.049121

【问题讨论】:

    标签: curl shopify put


    【解决方案1】:

    API 处理变体的方式似乎存在错误。在检查您请求中的变体时,您似乎传递了不正确的数据。

    应该是:

    "variants": [{variant_information}]

    即使如此,在这种情况下也不应该提高 500,而应该是 422。

    如果这对您的问题有帮助,请告诉我

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-12-25
      • 2018-04-29
      • 2020-11-16
      • 2022-07-17
      • 2021-10-16
      • 2016-01-30
      • 1970-01-01
      相关资源
      最近更新 更多