title: POST an invalid object: What HTTP STATUS Code do I have to return?
body: <p>I'm developing a REST service using WCF and I don't know which type of HTTP Status Code do I have to return when I <code>POST</code> an invalid <code>Message</code>. Note: A message here is like a chat message (a text and some data).</p>
  
  <p>This is how I have implemented the WCF Service:</p>
  
  <p><strong>IServiceContract</strong>:</p>
  
  <pre><code>[OperationContract]
  [WebInvoke(Method = "POST",
      UriTemplate = "/messages",
      RequestFormat = WebMessageFormat.Json,
      ResponseFormat = WebMessageFormat.Json,
      BodyStyle = WebMessageBodyStyle.Bare)]
  Message AddMessage(Message message);
  </code></pre>
  
  <p><strong>Service Implementation</strong>:</p>
  
  <pre><code>public Message AddMessage(Message message)
  {
      OutgoingWebResponseContext ctx =
          WebOperationContext.Current.OutgoingResponse;
  
      if (message == null)
      {
          ctx.StatusCode = System.Net.HttpStatusCode.RequestedRangeNotSatisfiable;
          ctx.StatusDescription = "message parameter is null";
  
          throw new ArgumentNullException("message", "AddMessage: message parameter is null");
      }
  
      using (var context = new AdnLineContext())
      {
          context.Entry(message).State = EntityState.Added;
          context.SaveChanges();
      }
  
      return message;
  }
  </code></pre>
  
  <p>Now I use <code>RequestedRangeNotSatisfiable</code> (HTTP 416). But I don't know if this is the HTTP Status code to return when I POST an invalid <code>Message</code>.</p>
  
  <p><strong>What kind of HTTP Status code do I have to return when I POST an invalid object?</strong></p>