Routing
Routing, simply put, is the process of receiving a request and mapping it to a controller action. If you are familiar with MVC routing, you will find that Web API routing is similar to it but with some differences; Web API uses the HTTP request type instead of the action name in the URL (as in the case of MVC) to select the action to be executed in the controller.
Routing configuration for Web API is defined in the file App_Start\WebApiConfig.cs
. The default routing configuration of ASP.NET Web API is as shown in the following:
namespace MovieTickets.WebAPI { public static class WebApiConfig { public static void Register(HttpConfiguration config) { config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); } } }
The default routing template of Web API is api/{controller}/{id...