Responses & Exceptions - C# SDK

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 list of entities would return  BulkAPIResponse  object.
  • 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(Attachment_Id)  etc.
  • Use the instance variable " Data " or " BulkData " property to get the entity data alone from the response wrapper objects.  APIResponse.Data  would return a single Zoho CRM entity object, while  BulkAPIResponse.BulkData  would return a list of Zoho CRM entity objects.
  • FileAPIResponse  has two defined methods namely  FileAPIResponse.GetFileName()  which returns the name of the file that is downloaded and  FileAPIResponse.GetFileAsStream()  that gives the file content as InputStream.

Note

BulkAPIResponse is a generic class. Hence, to get the records, the corresponding type has to be used.
  1. "ZCRMModule module = ZCRMModule.GetInstance("Contacts");
  2. BulkAPIResponse<ZCRMRecord> response = module.GetRecords();
  3. List<ZCRMRecord> records = response.BulkData;"

Other than data, these response wrapper objects have the following properties:

ResponseHeaders  - remaining API counts for the present day/window and time elapsed for the present window reset. It is available through:
  1. response.GetResponseHeaders()
ResponseInfo  - any other information, if provided by the API, in addition to the actual data.
  1. response.Info
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.BulkEntitiesResponse

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.


    • 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 - 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 ...
    • Installation - Python SDK

      The SDK can be installed for your client application through Pip. Pip is a tool for dependency management in Python. Installing Pip Please refer the document below to install pip https://pip.pypa.io/en/stable/installing/ Installing the SDK Run the ...
    • 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 ...