title: REST API JSON error code and error message
body: <p>I have been writing Web Services from a recent past, this is a sample success and error response.</p>
  
  <p><strong>error</strong></p>
  
  <pre><code>{
    "code": 1150,
    "status": false,
    "message": "API Student does not exist.",
    "serverTime": "2013-11-29 09:47:52"
  }
  </code></pre>
  
  <p><strong>success</strong></p>
  
  <pre><code>{
    "code": 200,
    "status": true,
    "data": {
      "id": 49
    },
    "serverTime": "2014-04-17 05:06:17"
  }
  </code></pre>
  
  <p>With regards to returning errors I have a confusion, why do we always return one error code and one message, for example, when username and password is required as input params, say a blank request is made, so what I return is a <strong>error code 1100</strong> and <strong>error message "Username is incorrect"</strong>. I never return the whole list of errors, for example, in this case, two error message with two error codes should be sent so it saves end users data &amp; time.</p>
  
  <p>This is a sample of what I suggest?</p>
  
  <pre><code>{
    "code": 1010,
    "status": false,
    "errors": [
      {
        "code": 1000,
        "name": "Username invalid"
      },
      {
        "code": 1001,
        "name": "Password invalid"
      },
          {
        "code": 1002,
        "name": "Password not strong"
      }
    ],
    "serverTime": "2013-12-03 12:34:02"
  }
  </code></pre>
  
  <p>Why is this not a good way to do? I have not seen this in either Twitter API or Facebook API.</p>