The service operation will never receive a value for the input parameter

Topics: Web Api
Feb 9, 2012 at 3:49 PM
Edited Feb 9, 2012 at 4:21 PM

** DELETED - IGNORE **

** DELETED - IGNORE **

** DELETED - IGNORE **

I don't even know if I should be posting this considering that it's all going to be thrown out, but whatevs.

It appears that WebInvoke DOES NOT default to POST like MSDN says. This is a problem because it does not match the documentation.

I have no idea what it defaults to, but it is NOT post, because if you set it to post it works.

        [WebInvoke(UriTemplate = "price/pricestimate")]
        [Authorize]
        public NewPriceEstimate GetPriceEstimate(NewPriceEstimate PriceEstimate)
        {
            return new NewPriceEstimate();
        }

That is throwing this error. That should NOT be the base because it should be post.
Feb 9, 2012 at 4:00 PM

Maybe raise issue if you say that Web API isn't correctly enforcing the semantics of the WebInvoke attribute?  Agree with you that the docs do say that if method is missing, then method defaults to POST.

Feb 9, 2012 at 4:20 PM

Nevermind I figured it out I'm stupid.

The documentation says that if you name your methods "Get" "Post" "Delete" "Put" then it'll make that the method.

But its if it STARTS WITH. Notice I start with "Get".

Deleting this post its by design.

Coordinator
Feb 9, 2012 at 4:23 PM

Yes, we added some conventions in WebApiConfiguration that handle matching the method by convention. All you need to use is WebInvoke.