添加产品变体 - 404 错误

Add Product Variant - 404 Error

我正在开发一个 VB.NET 应用程序来与我们的新 Shopify 商店进行交互。我正在根据 Oracle 数据库中的数据自动化产品 additions/updates/removal。

基本上,应用程序会为模式创建一个新的 Shopify 部件,然后为该模式中的每个 sku 创建产品变体。它通过使用 HttpWebRequest class 发送和发送请求来实现。昨天下午一切正常,今天由于某种原因它在产品变体 creation/update 上失败,错误代码为 404 - Not Found。

产品添加请求 JSON 如下。这非常有效,它在 Shopify 上创建了我可以通过管理面板看到的部分。这已发布到 URL“https://key:password@bath-and-window-direct.myshopify.com/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": []
        }
    }
}

在那之后,我立即发布以下 JSON 以将产品变体添加到这个新创建的部分,到 URL“https://key:password@bath-and-window-direct.myshopify.com/admin/products/7874734983/variants.json”。这是 returns 404 - Not Found 错误通过 HttpWebRequest class.

的调用
{
    "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"
        }]
    }
}

我做错了什么? URLs,当复制到网络浏览器时,工作得很好......我可以看到当前数据的所有 JSON。但是在尝试添加变体时,我得到了 404。

尝试从变量和元字段中省略 "id": 0 属性。 Shopify 将自动确定 ID。