Responses & Exceptions - PHP SDK

Responses & Exceptions - PHP SDK

Response Objects

All the API calling methods will return one of the following responses, which serve as a wrapper objects for the Zoho CRM APIs' responses.


Responses
Description
APIResponse
Returns a single API response object.
BulkAPIResponse
Returns a Bulk API response object, containing multiple objects.
FileAPIResponse
Returns the file API response object.


A method seeking a single entity would return APIResponse object, whereas a method seeking a list of entities would return BulkAPIResponse object.

APIResponse

  • Use the function getData() to get the entity data from the response wrapper objects for APIResponse.

  • APIResponse.getData() would return a single Zoho CRM entity object. (ex: ZCRMRecord, ZCRMModule, ZCRMField, etc..).
      For example: a single record/field/module information.

BulkAPIResponse

  1. Use the function getData() to get the entity data from the response wrapper objects for BulkAPIResponse.

  2. BulkAPIResponse.getData() would return an array of Zoho CRM entity objects (ex: ZCRMRecord, ZCRMModule, ZCRMField, etc..).
      For example: a multiple records/fields/modules information.

FileAPIResponse

  • FileAPIResponse will be returned for file download APIs to download a photo or an attachment from a record or note such as record.downloadPhoto() record.downloadAttachment() etc.

  • FileAPIResponse has two defined methods namely FileAPIResponse.getFileName() which returns the name of the file that is downloaded and FileAPIResponse.getFileContent() that gives the file content as String.

Additional Responses

Other than above response objects, there are response wrapper objects have the following properties:

ResponseInfo - any other information, if provided by the API, in addition to the actual data.
  1. response.getInfo()
List<EntityResponse> - status of individual entities in a bulk API. For example: an insert records API may partially fail because of a few records. This dictionary gives the individual records’ creation status. It is available through:
  1. response.getEntityResponses()


Check Exceptions

All unexpected behaviors like faulty API responses, SDK anomalies are handled by the SDK and are thrown only as a single exception —  ZCRMException . Hence, it's enough to catch this exception alone in the client app code.


SEE ALSO

Release Notes
    • Related Articles

    • Responses & Exceptions - Python SDK

      APIResponse, BulkAPIResponse and FileAPIResponse are the wrapper objects for Zoho CRM APIs’ responses. All API calling methods would return one of these three objects. A method-seeking entity would return APIResponse object, whereas a method-seeking ...
    • Responses & Exceptions - Java SDK

      APIResponse, BulkAPIResponse and FileAPIResponse are the wrapper objects for Zoho CRM APIs’ responses. All API calling methods would return one of these three objects. A method-seeking entity would return APIResponse object, whereas a method-seeking ...
    • Responses & Exceptions - C# SDK

      APIResponse, BulkAPIResponse and FileAPIResponse are the wrapper objects for Zoho CRM APIs’ responses. All API calling methods would return one of these two objects. A method-seeking entity would return  APIResponse  object, whereas a method-seeking ...
    • Release Notes - PHP SDK

      ZOHO CRM/PHP SDK 2.0.1 Install command composer require zohocrm/php-sdk:2.0.1 Notes Enhancement Tag names can contain spaces in between them, while associating with records. Tag names can be retrieved as "ZCRMTag" objects in records function. ZOHO ...
    • Installation - PHP SDK

      Install Composer(if not installed) Run this command to install the composer curl -sS  https://getcomposer.org/installer  | php To install composer on mac/ linux machine: https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx To install ...