A feature that has just recently been released in the ASP.NET Web API 2 framework, which the Second Street API recently upgraded to, is attribute routing. Before Web API 2, we were constrained to convention based routing using route templates in a global WebApiConfig.cs, which looks like this:

public static class WebApiConfig  
{
    public static void Register(HttpConfiguration config)
    {
        config.Routes.MapHttpRoute(
            name: "Fields Route",
            routeTemplate: "fields/{id}",
            defaults: new { controller = "Field", id = RouteParameter.Optional }
        );

        config.Routes.MapHttpRoute(
           name: "FieldOptions Route",
           routeTemplate: "field_options/{id}",
           defaults: new { controller = "FieldOption", id = RouteParameter.Optional }
       );
   }
}

In this approach, the routes live separately from the controller class files, and the GET, POST, PUT, and DELETE methods are all defined by a single route template. With this approach it is clear where all the routes are in general, but as the number of routes grows it can get chaotic. On top of that, when the routes and the controllers live separately from each other, it can be confusing to associate routes to their respective controller when looking through the global file. The only indicator is the designation of controller = "FieldOption", which then requires you to manaully look up that controller file yourself. With Attribute Routing, you can specify RESTful Url patterns on the endpoint methods within the controller itself.

Benefits of Attribute Routing

Simple Examples

[System.Web.Http.Route("fields/{id:int}"), HttpGet]
 public HttpResponseMessage Get([Http.FromUri]FieldApiRequest fieldApiRequest)

[System.Web.Http.Route("fields"), HttpPost]
 public HttpResponseMessage Post([Http.FromBody]JObject jObject, [Http.FromUri]FieldApiRequest fieldApiRequest)

Using Route Prefix

[System.Web.Http.RoutePrefix("fields")]
public class FieldController : BaseApiController  
{
   [System.Web.Http.Route("{id:int}"), HttpGet]
    public HttpResponseMessage Get([Http.FromUri]FieldApiRequest fieldApiRequest)

    [HttpPost]
    public HttpResponseMessage Post([Http.FromBody]JObject jObject, [Http.FromUri]FieldApiRequest fieldApiRequest)
}

//Override route prefix
    [System.Web.Http.Route("~/field/new"), HttpPost]
    public HttpResponseMessage Post([Http.FromBody]JObject jObject, [Http.FromUri]FieldApiRequest fieldApiRequest)

Default Values

System.Web.Http.Route("fields/{id:int=1}")  

Route Constraints

System.Web.Http.Route("accounts/{x:int}")  
ConstraintDescriptionExample
alphaMatches uppercase or lowercase Latin alphabet characters (a-z, A-Z){x:alpha}
boolMatches a Boolean value.{x:bool}
datetimeMatches a DateTime value.{x:datetime}
decimalMatches a decimal value.{x:decimal}
doubleMatches a 64-bit floating-point value.{x:double}
floatMatches a 32-bit floating-point value.{x:float}
guidMatches a GUID value.{x:guid}
intMatches a 32-bit integer value.{x:int}
lengthMatches a string with the specified length or within a specified range of lengths.{x:length(6)}
{x:length(1,20)}
longMatches a 64-bit integer value.{x:long}
maxMatches an integer with a maximum value.{x:max(10)}
maxlengthMatches a string with a maximum length.{x:maxlength(10)}
minMatches an integer with a minimum value.{x:min(10)}
minlengthMatches a string with a minimum length.{x:minlength(10)}
rangeMatches an integer within a range of values.{x:range(10,50)}
regexMatches a regular expression.{x:regex(^\d{3}-\d{3}-\d{4}$)}

Source: http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2