How to develop an ASP.NET Web API to accept a complex object as parameter?

By default complex types are read from body, that’s why you are getting null.

Change your action signature to

 public IEnumerable<Users> Get([FromUri]MyApiParameters parameters)

if you want the model binder to pull the model from the querystring.

You can read more about how Web API does parameter binding in the excellent article by Mike Stall from MSFT – http://blogs.msdn.com/b/jmstall/archive/2012/04/16/how-webapi-does-parameter-binding.aspx

Leave a Comment