title: understanding REST Response and HTTP status code
body: <p>I wanted to know how I should respond in my REST API.</p>
  
  <p>Valid Example:</p>
  
  <pre><code>http://blah.com/api/v1/dosomething/123
  </code></pre>
  
  <p>The above is a valid request and currently I have a HTTP Status of 200 with a JSON response</p>
  
  <pre><code>{
      "dosomething": {
          "status": "OK",
          "results": "123"
      }
  }
  </code></pre>
  
  <p>Now my question is, if the parameter passed is not valid ( I'm expecting a string of whole numbers ), do I return a HTTP Response of 200 and pass the error status back in the JSON response or should I pass something like a HTTP 400 response ( Bad request ) and list the error / issue with the request in the JSON response?</p>
  
  <p>Error Example:</p>
  
  <pre><code>http://blah.com/api/v1/dosomething/123a
  </code></pre>
  
  <p>JSON Response:</p>
  
  <pre><code>{
      "dosomething": {
          "status": "ERROR",
          "errors": [
              "Value passed: |123a| must be a integer."
          ]
      }
  }
  </code></pre>
  
  <p>Again my question is should I pass a 200 or 400 HTTP status on the request where the parameter passed is not what I'm expecting? Or should this always be a 200 response as the request is working?</p>
  
  <p>What is considered best practice? </p>