Handling Errors
When making requests to the REST Interfaces, errors may occur for a variety of reasons. When they do occur, the interfaces return an Error object.
Before processing the response from an interface, your client application must first check whether the returned JSON object is an Error object. If it is, your application can examine the contents of the object to determine what type of error occurred, and then call the appropriate error handling code.