I'm trying to create new/update products by passing a JSON (example.json) formatted file into my shop in C# .NET.
Is it possible to do something like
dynamic createProductResponse = client.Post("/admin/products.json", "c:\example.json");
Where the example.json files contain all the updated/new products. Currently, the only thing that works is passing a JObject like this:
JObject obj = new JObject { {"product", new JObject{ {"title", "Shoes"}, {"product_type", "Men"}, {"id", "1234566"}, {"published_at", new DateTime(DateTime.UtcNow.Ticks, DateTimeKind.Utc)}, {"vendor", "Vendorizer"}, {"variants", new JArray{ new JObject { {"barcode", null}, {"compare_at_price", "100.00"}, { "created_at", "2013-08-04T10:43:20-07:00"}, { "fulfillment_service", "manual"}, { "grams", "100"}, { "id", "342493891"}, { "inventory_management", "shopify"}, { "inventory_policy", "deny"}, { "option1", "DARK BROWN"}, { "option2", "7"}, { "option3", null}, { "position", 1}, { "price", "75.00"}, { "product_id", "149743231"}, { "requires_shipping", true}, {"title", "DARK BROWN / 7"}, {"sku", "SKUTHING12345"}, {"taxable", true}, { "updated_at", "2013-08-04T10:43:20-07:00"}, { "inventory_quantity", 5} }, }}, } } };
Am I approaching this incorrectly?
I can obviously update/create new products this way, but it's rather tedious. Since I can retrieve a JSON file of all my products, I was thinking there's a way to also upload a JSON file with the changes.
Thanks for any help you can offer!