In ASP.NET Web API, how can I get two actions, both routed for the same URL and same HTTP method, to be distingushable only by their different parameter types?
I'd like to be able to POST
either a single JSON object or a JSON array of objects.
I'm expecting it to work like this:
[HttpPost]
public virtual object Post([FromBody]IDictionary<string, object> values)
{
//add new object to collection
}
[HttpPost]
public virtual IEnumerable<object> Post([FromBody] IDictionary<string, object>[] array)
{
return array.Select(Post);
}
However, if I do this and attempt to call either actions, I get this error:
Multiple actions were found that match the request