C# code for HttpPost with Authorization Token
Assembly : System.Net.Http
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var res = await client.PostAsync("URL",
new StringContent(JsonConvert.SerializeObject(yourObject),Encoding.UTF8, "application/json"));
var resp =res.Content.ReadAsStringAsync().Result;
var response = res;
}
No comments:
Post a Comment