A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
I'm tryng to write a c# proc to set inventory level of my product:
Set_inv
{
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
const string url = "https://myshop.myshopify.com/admin/api/2022-10/inventory_levels/set.json";
WebRequest req = WebRequest.Create(url);
req.Method = "POST";
req.ContentType = "application/json";
req.Headers.Add("X-Shopify-Access-Token", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
WebResponse response = null;
String apiKey = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy";
String password = "zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
string Str = apiKey + ":" + password;
byte[] byt = System.Text.Encoding.UTF8.GetBytes(Str);
Str = System.Convert.ToBase64String(byt);
NetworkCredential SimpleCredential = new NetworkCredential(apiKey, password);
req.Credentials = SimpleCredential;
req.Headers.Add("Authorization", "Basic " + Str);
StringBuilder postData = new StringBuilder();
postData.Append("{");
postData.Append("\"location_id\":35545448559");
postData.Append(",");
postData.Append("\"inventory_item_id\":4470520184943");
postData.Append(",");
postData.Append("\"available\":25");
postData.Append("}");
string buildJson = postData.ToString();
byte[] data = Encoding.UTF8.GetBytes(buildJson);
req.ContentLength = data.Length;
Stream dataStream = req.GetRequestStream();
dataStream.Write(data, 0, data.Length);
dataStream.Close();
WebResponse resp = req.GetResponse();
}
I get an error: 406: not acceptable, I think something of wrongs in the headers but i don't know what.
Anyone cab help me?
Thank you anyway
@Abccom I can help with the CURL operation let me know you still need help.
Yes, I need . thank you