I have a API action:
[HttpGet, Route("{id}/overview/")]
public async Task<HttpResponseMessage> Overview(string id, DateTime from, DateTime? to)
{
...
}
As you noticed, to is optional parameters, but when I make request:
'/api/cream/3d7dd454c00b/overview?from=2016-09-04T18:00:00.000Z
I got 404 error. If I delete to from parameters:
public async Task<HttpResponseMessage> Overview(string id, DateTime from)
then all works fine. How to force it work with to parameters?
tois not optional. You will need to change it to an optional argument. ieOverview(string id, DateTime from, DateTime? to = null). That is all.