What are the request to overloaded method rules for GET? bug?http://forums.asp.net/t/1774764.aspx/1?What+are+the+request+to+overloaded+method+rules+for+GET+bug+Thu, 01 Mar 2012 16:14:06 -050017747644855267http://forums.asp.net/p/1774764/4855267.aspx/1?What+are+the+request+to+overloaded+method+rules+for+GET+bug+What are the request to overloaded method rules for GET? bug? <p>In a&nbsp;multi-tenant app, the request has an tenant identifier,&nbsp;the route is setup and value passed in the using the route to calls.</p> <p>I would like the external api&nbsp;to follow a REST uri convention and aligned to their corresponding verb methods:</p> <p>&nbsp;1)</p> <p>../tenant/<strong>tenant-identifier</strong>/api/<strong>products</strong></p> <p>IQueryable&lt;Dto.product&gt; Get(string tenantId)</p> <p>&nbsp;2)</p> <p>../tenant/<strong>tenant-identifier</strong>/api/<strong>products</strong>/<strong>5</strong></p> <p>Dto.product Get(string tenantId, int id)</p> <p>&nbsp;</p> <p>I can in part&nbsp;manage this if I have one get method but as soon as I have two I get, excuse pun, a few problems.&nbsp; Some rules would help or I can provide the results of a few tests I have done.</p> <p>In my testing:</p> <p>If&nbsp;<strong>id </strong>is not nullable, because it is required&nbsp;for this method,&nbsp;a HTTP status code of 400 - bad request is being returned, and error message &quot;<span style="color:black; font-family:'Verdana','sans-serif'; font-size:7.5pt">An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.&quot;, w</span>hen making a&nbsp;get request ../tenant/tenant-identifier/api/products.</p> <p>If <strong>id</strong> is marked nullable&nbsp;because it is optional&nbsp;parameter&nbsp;on the route. I get a 404&nbsp;- not found when making a request to ../tenant/tenant-identifier/api/products</p> <p>&nbsp;</p> <p>&nbsp;</p> 2012-02-28T16:21:43-05:004859338http://forums.asp.net/p/1774764/4859338.aspx/1?Re+What+are+the+request+to+overloaded+method+rules+for+GET+bug+Re: What are the request to overloaded method rules for GET? bug? <p><span style="color:black; font-family:'Verdana','sans-serif'; font-size:7.5pt">This is an interesting general question but my specific issue has been resolved and action routing now works for the two get methods.</span></p> <p>Moral: don't inadvertently<span style="color:black; line-height:115%; font-family:'Verdana','sans-serif'; font-size:7.5pt"> </span>use the mvc <span style="color:#2b91af">UrlParameter</span>.Optional&nbsp;make sure you use&nbsp;&nbsp;<span style="color:#2b91af; background-color:yellow">RouteParameter.Optional.</span> in System.Web.Http.</p> 2012-03-01T16:14:06-05:00