User1751268424 posted
Hi,
I'm trying to POST to my WebAPI server unsuccessfully. What is wrong with this code? I've tested this Web API using Postman am,d it's ok. Here is my code.
// Send Fire Event to PMK
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://192.168.151.100:8080/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(
new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
var serialize = JsonConvert.SerializeObject(fireEvent);
var response = await client.PostAsync("api/FireEvents",
new StringContent(serialize, Encoding.Unicode, "application/json"));
Thank you soo much
Jannen