I am trying to create a REST service using the .NET Web API. The URL I am trying to map is
/api/<controller>/<videoId>/chapters
I have a route setup that looks like the following:
RouteTable.Routes.MapHttpRoute(name: "Route1",
routeTemplate: "api/video/{id}/{action}",
defaults: new { controller = "Video", action = "Chapters"});
Which maps the following function in the controller:
[HttpGet]
[ActionName("Chapters")]
public string GetChapters() {
return "get chapters";
}
Everything maps correctly, but how do I get access to the <video_id> parameter in the URL from within the GetChapters function?
As a concrete example, the URL looks like this:
http://localhost/api/video/1/chapters
How do I get access to the parameters after controller, in this 1?