I have tried to create a httpwebrequest for post request to api site. The header details below;enter image description here
and I have tried below code;
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("https://www.etc.com/c/search");
//webRequest.Credentials = cache;
//webRequest.PreAuthenticate = true;
//header description
webRequest.Method = "POST";
webRequest.Connection = "keep-alive";
//webRequest.KeepAlive = true;
byte[] byteArray = Encoding.UTF8.GetBytes("{\"contains\":true,\"empName\":RAGS TO RACHES,\"injuryDate\":04/13/2018,\"state\":UT,\"stCd\":43}");
webRequest.Accept = "q=0.8;application/json;q=0.9";
webRequest.UserAgent = @"Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0";
webRequest.ContentType = "application/json";
webRequest.ContentLength = byteArray.Length;
webRequest.Referer = "https://www.etc.com/c/search";
webRequest.Headers.Add("Accept-Encoding: gzip, deflate, br");
webRequest.Headers.Add("Accept-Language: en-US,en;q=0.5");
//webRequest.Headers.Add("Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3");
using (Stream webpageStream = webRequest.GetRequestStream())
{
webpageStream.Write(byteArray, 0, byteArray.Length);
}
Not getting resposne.