Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8901

getting 201 status code instead of 200 when i hit an api url in my controller

$
0
0
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

Viewing all articles
Browse latest Browse all 8901

Trending Articles