mercredi 28 octobre 2015

How to add additional placeholder values to Web API routes

I'm researching building a restful API using the ASP.NET Web API framework.

The basic route format that's used is "api/{controller}/public/{category}/{id}"

I've read a lot about how the framework resolves the controllers and actions to execute within those controllers, and feel pretty comfortable with that.

Ultimately, what I need to do, however, is add an additional placeholder element before the controller section which will act as a routing element to determine the endpoint the action should be executed against. Ex. "api/{endpointId}/{controller}/public/{category}/{id}"

What's the easiest way to accomplish this in the Web API framework?




Aucun commentaire:

Enregistrer un commentaire