I am trying to post to my API that accepts JSON format data
I however get a 406 not acceptable error.
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
var user = "demo";
var password = "demo";
var base64String = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{user}:{password}"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", base64String);
string url = "https://api.fever.co.za/FTIntegration.svc/BalanceLookup";
var data = new
{
BalanceID = "4E45D053-044E-4C7E-A2A3-0743A7237811",
CardOrIDNumber = "8212225222075"
};
var stringContent = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json");
var response = await client.PostAsJsonAsync(url, stringContent );
What could be the cause of this error?