title: Should I have two different model classes to read and update object in Web API?
body: <p>Let say I have a API that sends simple messages to users. To send it I would use something like:</p>
  
  <pre><code>POST {
        Content: "Message here",
        To: "foo@bar.com"
  } api/messages
  </code></pre>
  
  <p>Now I want to read all sent messages but with user who send it (I had identity in cookie) and send time (assigned automatically). Again it seems to be simple:</p>
  
  <pre><code>GET api/messages
  </code></pre>
  
  <p>and I will get:</p>
  
  <pre><code>[{
    Content: "Message here",
    To: "foo@bar.com",
    From: "user1",
    Time: "0001-01-01T00:00:00"
  }]
  </code></pre>
  
  <p>From API controller side I will have two methods:</p>
  
  <pre><code>public class MessagesController : ApiController
  {
      [HttpPost, Route("Messages")]
      public HttpResponseMessage Post([FromBody] Message message)
      {
          messageRepository.Create(message);
          return Request.CreateResponse(HttpStatusCode.Created, "Message was send.");
      }
  
      [HttpGet, Route("Messages")]
      public HttpResponseMessage Get()
      {
          var response = new HttpResponseMessage(HttpStatusCode.OK)
          {
              Content = new StringContent(JsonConvert.SerializeObject(messageRepository.GetMessages()))
          };
          response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
          return response;
      }
  }
  </code></pre>
  
  <p>My problem is that the object what is send is different from object what i get. So I think I can't use same Message class. Why should I do then:</p>
  
  <ul>
  <li>Should I have two different classes here to do it proper way? (I will have more to code and i don't know is it correct from REST point of view)</li>
  <li>Should I use one class but ignore From and Time properties if user will send it to me?</li>
  <li>Should I told my user to send me From and Time but send null here? </li>
  </ul>