I'm building a set of web APIs that return data in JSON format. An external app performs an http (GET) request like this:
and this is the method which manage the http request:
[HttpGet]
[Route("search")]
public IHttpActionResult GetItems(string qualifier, IEnumerable<Dictionary<string, string>> sort)
{
Does something;
}
This is the problem: while the qualifier parameter is correctly valued, the sort (square-bracket notation in query string) parameter is instead null.
What's wrong?
Thanks in advance. Filippo
qualifieris ok, butsortisnull? Do you use ASP.NET Core 2 or it is old ASP.NET?qualifierwas correctly assigned the value "year" but thesortparameter was null. I use "old" ASP.NET. The use of bindingIEnumerable<Dictionary<string, string>>was suggested to me in an interesting article on parsing querystring containing arrays with square-bracket notation: linksearch. [FromQuery] attribute is not necessary if there is[ApiController]attribute. What is the problem with enumerable of dictionary?