title: Should input DTOs for RESTful endpoints match the output DTOs?
body: <p>I'm working on a RESTful API and I'm having some trouble wrapping my head around the procedure for supplying input to the API.</p>
  
  <p>Let's say I have a "Person" resource that can be fetched like this: <code>api/person/{id}</code> and returns an object like this:</p>
  
  <pre><code>public class Person
  {
      public int Id { get; set; }
      public string Surname { get; set; }
      public string GivenName { get; set; }
      public DateTime DateOfBirth { get; set; }
  }
  </code></pre>
  
  <p>If I want to update that person, should the API be expecting a full <code>Person</code> instance, or is it acceptable to use a separate DTO?</p>
  
  <p>Let's say for example the <code>DateOfBirth</code> cannot be changed, is it considered RESTful to accept this as input:</p>
  
  <pre><code>public class UpdatePersonDto
  {
      public string Surname { get; set; }
      public string GivenName { get; set; }
  }
  </code></pre>
  
  <p>This would mean I would have this endpoint <code>api/person/{id}</code> returning <code>Person</code> when using <code>GET</code>, while accepting as input <code>UpdatePersonDto</code> when using <code>PUT</code>.  This sounds wrong to me, but I'm not sure if I'm just being paranoid.</p>
  
  <p>So I guess my question sums up to this: <strong>Is it suitable to accept a data structure on a given resource endpoint that differs from what that endpoint would return?</strong></p>