I'm having some trouble with model binding with AttributeRouting ASP.NET Web API, though I don't know if this is a bug, an unimplemented feature or my own inexperience (likely the latter). I have an ApiController as follows:
[RoutePrefix("servers/{serverId}")]
public class UsersController : ApiController
{
[POST("users"), HttpPost]
public HttpResponseMessage SubscribeUser(string serverId, SubscribeUserRequest request)
{
...
}
}
The request is sent with a corresponding JSON body that reflects the SubscribeUserRequest model (already double-checked that). There's a lot of magic when model binding occurs, so I don't know if I'm even doing this correctly, or if I need to grab the JSON manually. Any help would be appreciated.
I'm having some trouble with model binding with AttributeRouting ASP.NET Web API, though I don't know if this is a bug, an unimplemented feature or my own inexperience (likely the latter). I have an
ApiController
as follows:The request is sent with a corresponding JSON body that reflects the SubscribeUserRequest model (already double-checked that). There's a lot of magic when model binding occurs, so I don't know if I'm even doing this correctly, or if I need to grab the JSON manually. Any help would be appreciated.