Responses and Exceptions
All SDK methods return an instance of the APIResponse class.
After a successful API request, the getObject() method returns an instance of the ResponseWrapper (for GET) or the ActionWrapper (for POST, PUT, DELETE).
Whenever the API returns an error response, the getObject() returns an instance of the APIException class.
ResponseWrapper (for GET requests) and ActionWrapper (for POST, PUT, DELETE requests) are the expected objects for Zoho CRM APIs’ responses.
However, some specific operations have different expected objects, such as the following:
Operations involving records in Tags
-RecordActionWrapperFor getting Record Count for a specific Tag operation
-CountWrapperFor operations involving BaseCurrency
-BaseCurrencyActionWrapperFor Lead convert operation
-ConvertActionWrapperFor retrieving Deleted records operation
-DeletedRecordsWrapperFor Record image download operation
-FileBodyWrapperFor MassUpdate record operations
-MassUpdateActionWrapper
-MassUpdateResponseWrapper
For GET Requests
The getObject() returns an instance of one of the following classes, based on the return type.
For application/json responses
- ResponseWrapper
- CountWrapper
- DeletedRecordsWrapper
- FileBodyWrapper
- MassUpdateResponseWrapper
- APIException
For File download responses
FileBodyWrapper
APIException
For POST, PUT, DELETE Requests
The getObject() returns an instance of one of the following classes
- ActionWrapper
- RecordActionWrapper
- BaseCurrencyActionWrapper
- MassUpdateActionWrapper
- ConvertActionWrapper
- APIException
These wrapper classes may contain one or an array of instances of the following classes, depending on the response.
- SuccessResponse Class, if the request was successful.
- APIException Class, if the request was erroneous.
For example, when you insert two records, and one of them was inserted successfully while the other one failed, the ActionWrapper will contain one instance each of the SuccessResponse and APIException classes.
All other exceptions such as SDK anomalies and other unexpected behaviours are thrown under the SDKException class.