Hi,
You can define your routing inside the RegisterRoute Method like following.
public static void RegisterRoutes(HttpRouteCollection routes) {
routes.MapHttpRoute(
"UserRolesHttpRoute",
"api/users/{key}/roles",
new { controller = "UserRoles" });
routes.MapHttpRoute(
"AffiliateShipmentsHttpRoute",
"api/affiliates/{key}/shipments",
new { controller = "AffiliateShipments" });
routes.MapHttpRoute(
"ShipmentStatesHttpRoute",
"api/shipments/{key}/shipmentstates",
new { controller = "ShipmentStates" });
routes.MapHttpRoute(
"AffiliateShipmentShipmentStatesHttpRoute",
"api/affiliates/{key}/shipments/{shipmentKey}/shipmentstates",
new { controller = "AffiliateShipmentShipmentStates" });
routes.MapHttpRoute(
"DefaultHttpRoute",
"api/{controller}/{key}",
new { key = RouteParameter.Optional });
}
You can know more about web api routing on this article.
[
Routing with Web API]
[
Multiple Controller Routing with Web API]
Hope this will help you.
thanks