Skip to main content

Responses and Exceptions

All SDK methods return an instance of the APIResponse class.

After a successful API request, the get_object() method returns an instance of the ResponseWrapper (for GET) or the ActionWrapper (for POST, PUT, DELETE).

Whenever the API returns an error response,the get_object() returns an instance of APIException class.

ResponseWrapper (for GET requests) and ActionWrapper (for POST, PUT, DELETE requests) are the expected objects for Zoho CRM API's responses.

However, some specific operations have different expected objects, such as the following:

  • Operations involving records in Tags:
    -RecordActionWrapper

  • Getting Record Count for a specific Tag operation:
    -CountWrapper

  • Operations involving BaseCurrency
    -BaseCurrencyActionWrapper

  • Lead convert operation
    -ConvertActionWrapper

  • Retrieving Deleted records operation:
    -DeletedRecordsWrapper

  • Record image download operation
    -FileBodyWrapper

  • MassUpdate record operations
    -MassUpdateActionWrapper
    -MassUpdateResponseWrapper

For GET Requests

  • The get_object() returns an instance of one of the following classes, based on the return type.

    • For application/json responses

      • ResponseWrapper
      • CountWrapper
      • DeletedRecordsWrapper
      • MassUpdateResponseWrapper
      • APIException
    • For file download responses

      • FileBodyWrapper
      • APIException

For POST, PUT, DELETE Requests

  • The get_object() returns an instance of one of the following classes, based on the return type.

    • For application/json responses

      • ActionWrapper
      • RecordActionWrapper
      • BaseCurrencyActionWrapper
      • MassUpdateActionWrapper
      • ConvertActionWrapper
      • APIException

These wrapper classes may contain one or a list of instances of the following classes, depending on the response.

  • SuccessResponse Class, if the request is successful.
  • APIException Class, if the request is 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 behaviors are thrown under the SDKException class.