Which HTTP code should be return from REST API?
<p>im currently working on a website which has Spring at backend and Angularjs at front side and we had discussed about back end responses to handle frontend's message dialogs and i have a question to ask:</p>

<p>Lets say i have an API : </p>

<pre><code>GET : /getstatistics
Request params : fromTime,toTime ( in timestamp format)
</code></pre>

<p>And if client make a request with invalid params like a string, which response code should be returned from server ? HTTP 400 bad request and response body with a message " fromTime and toTime should be in timestamp format" or HTTP 200 with same message?</p>

<p>I saw some Google's APIs for example Oauth, they're returning code 200 for a request with invalid access_token but ,in our project my opinion it should be HTTP 400 <strong>because Javascript has success and error callbacks, is it better for it just pop a red color dialog with message inside rather than a HTTP 200 code then still need to check the content of the message?</strong></p>

<p>Any advides and opinions are appreciated.</p>

<p>Thanks!</p>