PUT方法不发布数据ShopifyAPI

时间:2013-02-06 06:02:02

标签: curl shopify put

我正在使用使用CURL的ShopifyAPI,我已经为Create产品集成了API并分别使用POST和DELETE方法删除产品但是当我使用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

1 个答案:

答案 0 :(得分:0)

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

应该是:

"variants": [{variant_information}]

即便如此,在这种情况下应该提出500不应该是422。

如果这可以帮助您解决问题,请告诉我