新しいShopifyストアと対話するためのVB.NETアプリケーションを開発しています。私はOracleデータベースのデータに基づいて製品の追加/更新/削除を自動化するプロセスに入っています。製品バリアントの追加 - 404エラー
基本的に、アプリケーションはパターン用に新しいShopify部品を作成し、そのパターン内の各SKUの製品バリエーションを作成します。これは、HttpWebRequest
クラスを使用したPOSTおよびPUTリクエストによって行われます。これは、昨日の午後、現在は今日、何らかの理由で、404 - Not Foundエラーコードを使用して、製品のバリアントの作成/更新に失敗しています。
商品の追加リクエストJSONは以下のとおりです。これは完全に機能し、Shopifyで管理パネルから見ることができる部分を作成します。これは、URLに掲載され、「https://key:[email protected]/admin/products.json」(キーとパスワードは、私たちの資格情報を使用して置き換えられる)
{
"product": {
"id": 0,
"body_html": "A classic combination of embroidery and cut work form the flowing border, creating your own seaside retreat. ",
"title": "Seabreeze Sand",
"vendor": "SKL",
"product_type": "",
"published_scope": "global",
"tags": "J71227",
"variants": null,
"options": null,
"images": [{
"id": 0,
"product_id": 0,
"position": 1,
"src": "http:\/\/i320.photobucket.com\/albums\/nn353\/fkhphoto\/J71227main.jpg",
"variant_ids": null
}],
"image": null
}
}
これは私がこのコールの後に受けていたJSON応答である、と私はまた、一部は中に追加見ることができますShopifyの管理パネル:
{
"product": {
"id": 7874734983,
"title": "Seabreeze Sand",
"body_html": "A classic combination of embroidery and cut work form the flowing border, creating your own seaside retreat. ",
"vendor": "SKL",
"product_type": "",
"created_at": "2016-07-14T10:43:56-04:00",
"handle": "seabreeze-sand",
"updated_at": "2016-07-14T10:43:56-04:00",
"published_at": "2016-07-14T10:43:56-04:00",
"template_suffix": null,
"published_scope": "global",
"tags": "J71227",
"variants": [{
"id": 24925005383,
"product_id": 7874734983,
"title": "Default Title",
"price": "0.00",
"sku": "",
"position": 1,
"grams": 0,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": null,
"option1": "Default Title",
"option2": null,
"option3": null,
"created_at": "2016-07-14T10:43:56-04:00",
"updated_at": "2016-07-14T10:43:56-04:00",
"taxable": true,
"barcode": null,
"image_id": null,
"inventory_quantity": 1,
"weight": 0.0,
"weight_unit": "lb",
"old_inventory_quantity": 1,
"requires_shipping": true
}],
"options": [{
"id": 9404426823,
"product_id": 7874734983,
"name": "Title",
"position": 1,
"values": ["Default Title"]
}],
"images": [{
"id": 16242879303,
"product_id": 7874734983,
"position": 1,
"created_at": "2016-07-14T10:43:56-04:00",
"updated_at": "2016-07-14T10:43:56-04:00",
"src": "https://cdn.shopify.com/s/files/1/1363/2407/products/J71227main.jpg?v=1468507436",
"variant_ids": []
}],
"image": {
"id": 16242879303,
"product_id": 7874734983,
"position": 1,
"created_at": "2016-07-14T10:43:56-04:00",
"updated_at": "2016-07-14T10:43:56-04:00",
"src": "https://cdn.shopify.com/s/files/1/1363/2407/products/J71227main.jpg?v=1468507436",
"variant_ids": []
}
}
}
は、その直後に、私はURLに、この新しく作成された部分に「https://key:[email protected]/admin/products/7874734983/variants.jsonを」製品バリエーションを追加するには、次のJSONを投稿しています。これは、HttpWebRequest
クラスを介して404 - Not Foundエラーを返す呼び出しです。
{
"variant": {
"id": 0,
"product_id": 7874734983,
"title": "Seabreeze Tier Curtain in Sand",
"price": "11.99",
"sku": "J7122700013V09",
"compare_at_price": "0.00",
"position": 0,
"grams": 0,
"option1": "57X13 ROD POCKET VAL",
"option2": null,
"option3": null,
"taxable": true,
"barcode": "036326422417",
"weight": 0,
"weight_unit": "lb",
"inventory_quantity": 550,
"old_inventory_quantity": 550,
"requires_shipping": true,
"image_id": null,
"metafields": [{
"id": 0,
"key": "point1",
"value": "57 x 13 Valance",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point2",
"value": "To achieve the look in the photo, use one valance and one tier pair.",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point3",
"value": "Feels like you are in your own beach cottage.",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point4",
"value": "100% Polyester.",
"value_type": "string",
"namespace": "J7122700013V09"
},
{
"id": 0,
"key": "point5",
"value": " ",
"value_type": "string",
"namespace": "J7122700013V09"
}]
}
}
私は間違っていますか? URLをWebブラウザにコピーすると、正常に動作します...現在のデータのJSONをすべて見ることができます。しかし、バリアントを追加しようとすると、404が表示されます。
これは私のために働いていましたが、何らかの理由でメタフィールドから '' id ":0'プロパティを削除するだけでした。私は、製品、製品バリエーション、製品イメージ、および注文に問題のない同じものを送ってきましたが、メタフィールドに残すと、404 Not Foundエラーが発生して不適切と思われます。本当にありがとう! – RianBattle
'id'はあなたが何かを更新しているときにのみ使用されます。 'variant/ .json'または' metafields/ .json' –
HymnZ