Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call a RESTful API with ASP.NET 5

Working with ASP.NET 5 on my Mac in Visual Studio Code. I have a RESTful API I need to call and not sure exactly how to do it. I've seen many examples using WebClient, HttpClient, WebRequest and HttpWebRequest.

I think my pain point is the dnxcore50 framework. Can someone please point me in the right direction with some code samples?

like image 303
Richard.Davenport Avatar asked Oct 01 '15 15:10

Richard.Davenport


1 Answers

Here is an example about how to call a service. Please check the References and using carefully.

One important thing you have to do is install the Web API Client Libraries package: From the Tools menu, select NuGet Package Manager, then select Package Manager Console. In the Package Manager Console window, type the following command: Install-Package Microsoft.AspNet.WebApi.Client.

For the full source code, check this link.

Call service

like image 63
Triet Doan Avatar answered Oct 07 '22 15:10

Triet Doan