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

    • 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 ...
    • PHP SDK - An Overview

      PHP SDK offers a way to create client PHP applications that can be integrated with Zoho CRM. This SDK makes the access and use of necessary CRM APIs with ease. In other words, it serves as a wrapper for the REST APIs, making it easier to use the ...
    • Configuration - PHP SDK

      To access the CRM services through SDK, the client application must be first authenticated. This can be done by passing a key-value configuration pair to the initialization process. The $configuration array must be created. It will contain the ...
    • Initialization - PHP SDK

      The app would be ready to be initialized after defining the configuration array. The user can now proceed to generate the required tokens to run the app. The generation of the grant token can be done using two methods. Self-Client Redirection-based ...