Sorry if this is a dup, tried searching for an existing question but the site continually reported "Site is currently down for maintenance".
Anyway my question is how to specify a route may takes in variable number of parameters and use attribute routing for Web API 2.0?
Example, i have a hamburger shop which allows customers to place orders by submitting an order by hitting a URLs. The only requirement, at least 1 ingredient must be specified. After that as many ingredients may be specified and in my real api the set of
param values are from a set of 40000 or more items. So for these would be two valid orders requests:
http://www.food.com/api/Hamburger/cheese/pickles/onions/mustard/mayo/lettuce/ketchup/bacon
Or
http://www.food.com/api/Hamburger/mayo/lettuce/ketchup
The best i could find for some sample, but didn't work (assuming c#):
[HttpGet]
[Route( "api/Hamburger/{*options}")]
public void OrderHamburger( ??? ) {...}
Not sure what to use for the method's arguments. At first it felt like i should use "params string[] options", this failed, searching more found RoutingCollection. But stepping into with a debugger the value for options is null. Later i thought how about
regex like ".../{options:regex((\w)+)}" -- assuming "(\w)+" is group of words that may occur 1 to 'x' times. No matter what i've attempted debugging in the variable for "options" is always null .
Any suggestions how i can go about this? Thanks in advance.