API stands for Application Programming Interface. A Web API is an application programming interface for the Web,
That’s where the waiter or API comes in. The waiter is the
messenger – or API – that takes your request or order and tells the kitchen –
the system – what to do. Then the waiter delivers the response back to you; in
this case, it is the food.
API – Allows you to display videos on a web site.
API – Allows you to display Tweets on a web site.
API – Allows you to display Facebook info on a web site.
Create ASP.NET WEB API Empty Project
1) Select New Project > Visual C# -> Web -> ASP.NET Web Application (.net framework) and enter your application name. Here, I named it “TMSAPICOMPANY”. Now, click OK.
2) Select Empty Web API template and click OK to create the project.
3) Once you click OK, the project will be created with the basic architecture of ASP.NET WEB API
4) To install Entity Framework from NuGet, right click on References and select Manage NuGet Packages.
5) And now, search EntityFramework online to install and add the reference to your project.
6) After installing the EntityFramework from NuGet, it will be added as a reference to our project.
7) Right click on Models folder and select Add->ADO.NET Entity Data
Right click on Models folder and select Add->ADO.NET Entity Data
8) Right click on Controllers folder under your project-> select Add-> Controller
To implement scaffolding Select “Web API 2 Controller with actions, using Entity Framework” and click add
Again controller step follow. End of controller
9) Install Microsoft.AspNet.WebApi.cors in References<NuGet package manager.
(A) Goto your Web API project->Open the WebConfig file and add the below code
<directoryBrowse enabled=”true” />
(B) And add below code to your WebApiConfig.cs file
config.EnableCors(new EnableCorsAttribute(“*”, “*”, “GET,PUT,POST,DELETE”));
Now run your application, Yes! We got the successful services. We will validate all actions(CRUD) using postman