I have an Asp.Net Web API
with the following function
[HttpPost]
[Route("Employees")]
public IHttpActionResult Employees(SearchBindingModel searchOptions)
{
...
}
It's a function to search employees, so it should be a HttpGet
instead of HttpPost
. The problem is that the SearchBindingModel
is really complex and I don't know how I could write it as a query string.
The class look like this
public class SearchBindingModel
{
public IList<Criteria> Criterias { get; set; }
}
public class Criteria
{
...
}
public class FooCriteria : Criteria
{
...
}
public class BarCriteria : Criteria
{
...
}
Since a query string cannot contain hierarchy should I rethink my Web API?
or should I keep using HttpPost
instead?