Optional parameters no longer work in RC

Topics: ASP.NET Web API
Jun 6, 2012 at 9:35 PM
Edited Jun 6, 2012 at 9:38 PM

Hello,

In beta I had a web api action that looked something like this:

public class DesignsController : ApiController
{
	[Queryable(ResultLimit = 500)]
	public IQueryable GetList(string brandIds = null)
	{
	}
}

Which would allow me to access the action using either:

/api/designs

/api/designs?brandIds=foo

However the first route (/api/designs) no longer works after upgrading to the RC. I get the response:

No action was found on the controller 'Designs' that matches the request.

Is this something I'm doing wrong?

Jun 6, 2012 at 11:42 PM

Hi Grokys, you might be hitting this issue: http://aspnetwebstack.codeplex.com/workitem/148 which should be fixed in the latest codeplex bits but probably not in RC.

Can you try the following and see if it works around the issue?

public IQueryable GetList(string brandIds = "")

Thanks,

Yao

Jun 7, 2012 at 7:31 AM

Hi Yao, yes that works around the issue, thanks.

Dec 13, 2012 at 3:28 PM

FYI, this doesn't work with the latest nightlies at least with POST/PUT where the POST/PUT has the values in the URL.

Coordinator
Dec 13, 2012 at 3:58 PM

Thank you for reporting this issue.

Could you please create a new issue in our Issue Tracker with detailed steps on how to reproduce the issue (attaching a sample project is best) so that we can investigate?

Daniel Roth