In a controller, I have a method like this:
public class FooController : ApiController
{
[HttpPost]
public HttpResponseMessage ApplySomething(int id)
{
...
}
}
When I do a POST request like .../Foo/ApplySomething/ and passing id=1 as POST values, I get the error:
{
Message: "No HTTP resource was found that matches the request URI '.../Foo/ApplySomething/'."
MessageDetail: "No action was found on the controller 'Foo' that matches the name 'ApplySomething'."
}
But when I change the URL to have the ID (like .../Foo/ApplySomething/1) it works, but getting the value from the URL, not from POST values.
What I'm doing wrong?