title: How to develop an ASP.NET Web API to accept a complex object as parameter?
body: <p>I have the following Web API (GET):</p>
  
  <pre><code>public class UsersController : ApiController
  {
      public IEnumerable&lt;Users&gt; Get(string firstName, string LastName, DateTime birthDate)
      {
           // Code
      }
  }
  </code></pre>
  
  <p>It's a GET, so I can call it like this:</p>
  
  <pre><code>http://localhost/api/users?firstName=john&amp;LastName=smith&amp;birthDate=1979/01/01
  </code></pre>
  
  <p>and receive an xml result of user(s).</p>
  
  <p>Is it possible to encapsulate parameters to one class like this:</p>
  
  <pre><code>public class MyApiParameters
  {
      public string FirstName {get; set;}
      public string LastName {get; set;}
      public DateTime BirthDate {get; set;}
  }
  </code></pre>
  
  <p>And then have:</p>
  
  <pre><code>    public IEnumerable&lt;Users&gt; Get(MyApiParameters parameters)
  </code></pre>
  
  <p>I've tried it and anytime I try to get result from <strong><code>http://localhost/api/users?firstName=john&amp;LastName=smith&amp;birthDate=1979/01/01</code></strong>, the <code>parameter</code> is null.</p>