title: Update Shopify Variant returns 400 Bad Request
body: <p>I am trying to update the inventory of an existing variant in shopify using the following json and c# code:</p>
  
  <pre><code>    var p = new
      {
              id = "220994352",
              inventory_quantity = "0"
      };
  
      string url = "https://somestore.myshopify.com/admin/variants/220994352.json";
  
      ShopifyAuthorizationState authState = (ShopifyAuthorizationState)HttpContext.Current.Session["shopify_auth_state"];
      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
      request.Method = "PUT";
      request.ContentType = "application/json";
      request.Headers.Add("X-Shopify-Access-Token", authState.AccessToken);
  
      var serializer = new JavaScriptSerializer();
      var json = serializer.Serialize(p);
      json = "{ variant: " + json + "}";
  
      if (!String.IsNullOrEmpty(json))
      {
          using (var ms = new MemoryStream())
          {
              using (var writer = new StreamWriter(request.GetRequestStream()))
              {
                  writer.Write(json);
                  writer.Close();
              }
          }
      }
  
  
      string result = "";
      try
      {
          var response = (HttpWebResponse)request.GetResponse();
          using (Stream stream = response.GetResponseStream())
          {
              StreamReader sr = new StreamReader(stream);
              result = sr.ReadToEnd();
              sr.Close();
          }
      }
      catch (WebException ex)
      {
          WebHeaderCollection webHeaderCollection = ex.Response.Headers;
          foreach (var header in ex.Response.Headers.AllKeys)
          {
              Console.WriteLine(webHeaderCollection[header]);
          }
      }
  </code></pre>
  
  <p>However everytime I run this I get a 400 Bad request with no details about the error. 
  I am get read the inventory without any problems.</p>