Skip to main content

Posts

Showing posts from November, 2013

Web API Routing

The diagram below tries do describe the decision process behind selecting the method of the controller that will get executed. I've added a little extra documentation through the annotations on the diagram. 1 Action Based If the route defines the action parameter then the method selection will be based on the value of that parameter. The matching will be based on the method name or the method alias (A method in the controller may be aliased using the ActionName attribute). All the matching methods are then filtered by verb. The filtering is done by attributes applied to the method (such as HttpGet). Only the methods that match the verb of the incoming request will be returned. Methods with no attributes will also be considered valid as they don’t have any attributes to allow filtration. 2 Verb Based When the method selection is verb based we need to get the Http verb used in the request. The controller methods are then filtered in two ways: Get all the methods a