I have a WebAPI 2 ApiController with the following GET method:
public IEnumerable<MyData> Get([FromUri]string[] id, [FromUri]string[] filter, int? count)
My http request looks like this:
http://localhost/myapp/api/mycontroller?id=123&id=456&filter=A&filter=B&count=5
And life is good. But here's where I'm missing something. The following query string also works:
http://localhost/myapp/api/mycontroller?id=123&id=456&count=5
Notice that the `filter` parameter is missing. Not a problem. But then this fails:
http://localhost/myapp/api/mycontroller?id=123&id=456&filter=A&filter=B
The `count` parameter seems to be required, even though it is marked as nullable. If I just add it back in with no value it works again, even if the `filter` or `id` parameters are completely left out.
This seems strange to me, what's going on?
public IEnumerable<MyData> Get([FromUri]string[] id, [FromUri]string[] filter, int? count)
My http request looks like this:
http://localhost/myapp/api/mycontroller?id=123&id=456&filter=A&filter=B&count=5
And life is good. But here's where I'm missing something. The following query string also works:
http://localhost/myapp/api/mycontroller?id=123&id=456&count=5
Notice that the `filter` parameter is missing. Not a problem. But then this fails:
http://localhost/myapp/api/mycontroller?id=123&id=456&filter=A&filter=B
The `count` parameter seems to be required, even though it is marked as nullable. If I just add it back in with no value it works again, even if the `filter` or `id` parameters are completely left out.
This seems strange to me, what's going on?