Responses & Exceptions - Java SDK

Responses & Exceptions - Java SDK

APIResponseBulkAPIResponse 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 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.downloadPhotorecord.downloadAttachment etc.
  • Use the getData() method to get the entity data alone from the response wrapper objects. APIResponse.getData() would return a single Zoho CRM entity object, while BulkAPIResponse.getData() 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.
Other than data, these response wrapper objects have the following properties:
  1. ResponseHeaders - remaining API counts for the present day/window and time elapsed for the present window reset.
  2. ResponseInfo - any other information, if provided by the API, in addition to the actual data.
  3. 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 array gives the individual records’ creation status.

Start the App

The SDK requires the following line of code being invoked every time your app gets started.
  1. ZCRMRestClient.initialize();

This method should be called from the main class of your java application to start the application. It needs to be invoked without any exception.

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

    • Java SDK - Overview

      Java SDK offers a way to create client java 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 ...
    • Release Notes - Java SDK

      ZCRMSDK -VERSION 1.0.6  Downloadable JAR file  You can download the jar file for the version1.0.6 of Java SDKs at the end of this page.  Install command - Maven:(in pom.xml)  <repositories>        <repository>              ...
    • Persistence - Java SDK

      Persistent classes in an application implement the entities of the business problem. In Java SDK, two default persistence classes with their implementations are provided. On the other hand, if a developer wants his specific implementation, he can ...
    • Configuration - Java SDK

      Setting up the configuration is a system engineering process, for establishing and maintaining the consistency of the application's performance, functional and physical attributes with its requirements, design and operational information throughout ...
    • Initialization - Java SDK

      Now the app is ready to be initialized after defining OAuth configuration file and OAuth persistence handler class for your app. Generating grant tokens For a Single User The developer console has an option to generate grant token for a user ...