I'm looking to create an unbound action on a WebApi 2.2 OData 4 service, but can't figure out how to set it up correctly.
Here's my stripped down code (in a controller called UsersController):
[HttpPost]
public IHttpActionResult InitializeUser([FromODataUri] int key, ODataActionParameters parameters)
{
// code to save user to DB & initialize account information...
return Ok<User>(new User());
}
And my WebApiConfig method:
builder.Action("RegisterNewUser").ReturnsFromEntitySet<User>("Users");
I get back a 404 when I call this method in fiddler {"Message":"No HTTP resource was found that matches the request URI 'http://localhost/RegisterNewUser
'."}.
The odata service works fine, and supports all the normal CRUD verbs.