title: Shopify api updating variants returned error
body: <p>I wanted to update the <code>inventory_quantity</code> of the store products and I've got error saying </p>
  
  <blockquote>
    <p>The remote server returned an error: (400) Bad Request.</p>
  </blockquote>
  
  <p>This is how I implement it.</p>
  
  <pre><code>ProductVariant product = new ProductVariant();
  product.id = 1962693211;
  product.inventory_quantity = 20;
  product.inventory_management = "shopify";
  
  string ordersApi = ConfigurationManager.AppSettings["Shopify_Api_Inventory"];
  string url = ordersApi.Replace("{StoreName}", _cred.StoreName);
  url = url.Replace("{id}", product.id.ToString());
  string xmlStringResult = string.Empty;
  
  
  try
  {
      var req = (HttpWebRequest)WebRequest.Create(url);
      req.Method = "PUT";
      req.ContentType = "application/json";
      req.Credentials = GetCredential(url);
      req.PreAuthenticate = true;
  
      var json = JsonConvert.SerializeObject(product);
      json = "{ variant: " + json + "}";
  
  
  
      if (!String.IsNullOrEmpty(json))
      {
          using (var ms = new MemoryStream())
          {
              using (var writer = new StreamWriter(req.GetRequestStream()))
              {
                  writer.Write(json);
                  writer.Close();
              }
          }
      }
  
      using (var resp = (HttpWebResponse)req.GetResponse())
      {
          if (resp.StatusCode != HttpStatusCode.OK)
          {
              string message = String.Format("Call failed. Received HTTP {0}", resp.StatusCode);
              AppendLog(string.Format("Error: {0}", message));
              return xmlStringResult;
          }
  
          var sr = new StreamReader(resp.GetResponseStream());
          xmlStringResult = sr.ReadToEnd();
      }
  }
  catch (Exception ex)
  {
      AppendLog(string.Format("Error: {0}", ex.Message));
  }
  </code></pre>
  
  <p>Thank you in advance for the help.</p>