I am Trying to list Product on Shopify Using Web API
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url + "products.json");
request.Credentials = new NetworkCredential(username, password);
request.KeepAlive = false;
request.ProtocolVersion = HttpVersion.Version11;
request.Method = "POST";
byte[] postBytes = Encoding.UTF8.GetBytes(jsonstring);
request.ContentType = "application/json; charset=UTF-8";
request.Accept = "application/json";
request.ContentLength = postBytes.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(postBytes, 0, postBytes.Length);
requestStream.Close();
HttpWebResponse response = null;
try
{
response = (HttpWebResponse)request.GetResponse();
}
catch (Exception a)
{
Console.WriteLine(a.ToString());
}
The Request I am Sending to List Product is in Json Format That is this
{"product":{"title":"OPI FULL BLACK CORDED GAMING MOUSE 789","body_html":" Here testing item, here some features
","product_type":"","vendor":"Please Select Vendor","tags":"","status":"active" ,"taxable":"true","options":[],"images":[
{
"src": "https://business.tradingzon.com/images/itemimages/15Json Turneryg2 (151).jpg"
},
{
"src": "https://business.tradingzon.com/images/itemimages/15Json Turneryg1 (253).jpg"
},
{
"src": "https://business.tradingzon.com/images/itemimages/15Json Turneryg3 (135).jpg"
},
{
"src": "https://business.tradingzon.com/images/itemimages/15Json Turnere (38).jpg"
}
],"variants":[
{
"title": "Default Title",
"barcode": "",
"inventory_quantity": 8,
"option1": "Default Title",
"price": 5.49,
"weight": 0.3,
"weight_unit": "kg",
"sku": "JSN-YG-02-1300",
"grams": 0,
"tracked": "true",
"compare_at_price": 8,
"inventory_policy": "deny"
}
]}}
User | Count |
---|---|
19 | |
17 | |
13 | |
11 | |
11 |