Responses and Exceptions
All SDK method calls return an instance of the APIResponse class.
APIResponse<ResponseHandler> and APIResponse<ActionHandler> are the wrapper objects for Zoho CRM APIs’ responses. All API calling methods would return one of these two objects.
Use the getObject() method to obtain the response handler interface depending on the type of request (GET, POST,PUT,DELETE).
Whenever the API returns an error response, the response will be an instance of APIException class.
The following are the wrappers with their handlers for the respective APIs:
For operations involving records in Tag:
-APIResponse<RecordActionHandler>For operations involving BaseCurrency:
-APIResponse<BaseCurrencyActionHandler>For Lead convert operation:
-APIResponse<ConvertActionHandler>For retrieving Deleted records operation:
-APIResponse<DeletedRecordsHandler>For Record image download operation:
-APIResponse<DownloadHandler>MassUpdate record operation:
-APIResponse<MassUpdateActionHandler>
-APIResponse<MassUpdateResponseHandler>
For GET Requests
APIResponse.getObject() returns the response handler interface.
This ResponseHandler interface encompasses the ResponseWrapper class (for application/json responses), file body wrapper class (for file download responses), and the APIException class.
This CountHandler interface encompasses the CountWrapper class (for application/json responses) and the APIException class.
This DeletedRecordsHandler interface encompasses the DeletedRecordsWrapper class (for application/json responses) and the APIException class.
This DownloadHandler interface encompasses the FileBodyWrapper class (for file download responses responses) and the APIException class.
This MassUpdateResponseHandler interface encompasses the MassUpdateResponseWrapper class (for application/json responses) and the APIException class.
For POST, PUT, DELETE Requests
APIResponse.getObject() returns the ActionHandler interface.
The ActionHandler interface encompasses the ActionWrapper class (for application/json responses) and the APIException class.
The ActionResponse interface encompasses the SuccessResponse class (for application/json responses) and the <>strongAPIException class.
The RecordActionHandler interface encompasses the RecordActionWrapper class (for application/json responses), and the APIException class.
The BaseCurrencyActionHandler interface encompasses the BaseCurrencyActionWrapper class (for application/json responses), and the APIException class.
The MassUpdateActionHandler interface encompasses the MassUpdateActionWrapper class (for application/json responses), and the APIException class.
The ConvertActionHandler interface encompasses the ConvertActionWrapper class (for application/json responses), and the APIException class.
If the root key of the response is not "data" (errors such as Internal Server Error), then the ActionResponse interface with either the SuccessResponse class or APIException class is returned.
All other exceptions such as SDK anomalies and other unexpected behaviors are thrown under the SDKException class.