0

我正在使用使用 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
4

1 回答 1

0

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

它应该是:

"variants": [{variant_information}]

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

让我知道这是否可以帮助您解决问题

于 2013-02-06T14:51:36.177 回答