Jsend Responses
Valdit API Responses follows the JSend pattern1[^2] , . This pattern combines the standard HTTP response codes with a lightweight JSON wrapper, that structures the response on the Application level.
JSend separates responses into three basic types and defines required and optional keys for each type:
Type | Description | Required Keys | Optional Keys |
---|---|---|---|
success | Everything went well, and (usually) some data is returned. | status, data | |
fail | There was a problem with the data submitted, or some pre-condition of the API call wasn’t satisfied | status, data | |
error | An error occurred in processing the request, i.e. an exception was thrown | status, message | code, data |
Table 2: JSend Response-types
Note that you will always receive the status key. The status key will indicate the response-type.
-
See https://labs.omniti.com/labs/jsend for more information on the JSend pattern. ↩︎