i'm using asp.net mvc, in controller i have create a method by which i want to get token by api, first i was trying with different code that was give exception of status code 415, unsupported media type, now i have modify my code and now its gives 201 instead of 200 in @response@ variable but i want to get token in response, in case of 201 server only send the reference of data not original data, please anyone can suggest me, any help will be highly appreciated
thanks
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(@abc.com/@);
var response = client.PostAsJsonAsync(@api/token@,@{}@).Result;
if (response.IsSuccessStatusCode)
{
Console.Write(@Success@);
}
else
Console.Write(@Error@);
}
i want to get token by 200 status code
↧