title: REST API - best method for error handling
body: <p>When constructing an API response, which method is better for (manually) returning the status code to indicate the validity of the request:</p>
  
  <p>1 - Embed a response code within the JSON response</p>
  
  <pre><code>{
    'status_code' =&gt; 200,
    'status_message' =&gt; 'OK',
    'data' =&gt; { ... }
  }
  </code></pre>
  
  <p>2 - Or is it better to modify the HTTP Headers Status field?</p>
  
  <pre><code>Request URL:http://somesite.com
  Request Method:GET
  Status Code: 200 (EDITING THIS ONE)
  </code></pre>
  
  <p>I would think that the HTTP Statuses should only be regarding connection errors and file retrieval errors that occur at the server level rather than altering this to address application level errors.</p>
  
  <p>Any good articles and resources to read would be very appreciated as well.</p>