Web API : Configuration over Convention

In ASP.NET Web API, the default convention is to give the action method the same name as the HTTP verb or to name the method so that it starts with the HTTP method. In this article, we will override this default behaviour. 

For e.g., in the previous article we use method name GET to handle HTTP GET. So by convention action method can be GetStudents, GetAllStudent or GetStudentById.

By the same way, the action methods of POST, PUT, and DELETE will respectively handle HTTP POST, PUT, and DELETE.  To override this convention, we can use the AcceptVerbs attribute, or use  HttpGet, HttpPost, HttpPut, HttpDelete, and so on. Continue reading

Advertisements