- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Add Two Nuget package.
Microsoft.Net.http and
Newtonsoft.JSON
then call below code in your .cs file
/**url**/
String url = "";
/**create new object of the input json**/
object userInfos = new { employee_id = "-2", employee_code = entry_email.Text, employee_password = entry_pass.Text };
/**serialize input json**/
var jsonObj = JsonConvert.SerializeObject(userInfos);
using (HttpClient client = new HttpClient())
{
StringContent content = new StringContent(jsonObj.ToString(), Encoding.UTF8, "application/json");
var request = new HttpRequestMessage()
{
RequestUri = new Uri(url),
Method = HttpMethod.Post,
Content = content
};
//you can add headers
//request.Headers.Add("key", "value");
var response = await client.SendAsync(request);
string dataResult = response.Content.ReadAsStringAsync().Result;
var result = JsonConvert.DeserializeObject<List<RootObject>>(dataResult);
}
Comments
Post a Comment