aftonApi separates errors out into two (2) categories: HTML status code errors, and aftonApi business logic errors. On every api call response you must be set up to handle both.
The error handling approach is based upon the notion that if aftonApi can fully process a request, with no internal infrastructure or environmental issues, then we should tell the consumer this via a 200 HTML Status OK response. This means that yes, we've fully understood what you've attempted to do via this call. However when you are not able to do what you've attempted to do based upon aftonApi business rules, we will tell you that we've fully processed your request (i.e. 200 HTML Status OK), but here's why you can't do it (i.e. business rules error) via the hasErrors flag.
To handle aftonApi call responses, do this:| Property Name | Data Type | Description |
|---|---|---|
| hasErrors | true/false | TRUE - the server was able to fully process your request, but a business logic error has occurred. You as the consumer should always be interested in this error and respond to the condition accordingly. FALSE - the call completed successfully with no business logic errors. |
| consolidatedErrorMessage | String | A human readable error message that could be the consolidation of multiple error messages based upon what the error actually is. |
| data | String (JSON) | Always JSON unless otherwise stated in the api call's documentation. On a successful call, this is where you find the actual data you are requesting via the call. Consult the call's specific api documentation section to find out what is in this data. |