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 に答える