For nested resources, I would suggest creating very specific routes for the controllers / actions that you want to access.
routes.MapHttpRoute( name: "Posts Routes", routeTemplate: "api/posts/{postId}/comments/{commentID}", defaults: new { controller = "Posts", action="CommentsForPosts" } ); public HttpResponseMessage CommentsForPosts(int postId, int commentID) {
There is no agreement in the structure of nested resources, but routing gives you the flexibility to map your controllers, methods, and URIs, however you consider it necessary
cecilphillip
source share