Configuration - Java SDK

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 its life.

In our Java SDK with ZohoCRM, two basic types of configurations are supported to hold OAuth information and ZCRM information. These configurations information are stored in property files with their respective attributes and values. The configuration files are, 
  • oauth_configuration.properties
  • zcrm_configuration.properties

Configuration - OAuth

Before you get started with creating your java application, you need to first authenticate the app with Zoho. And to do that there are some configuration procedures that need to be in place. Basically, two different property files are needed to be configured into the SDK to provide Oauth information and ZCRM Configuration information.

oauth_configuration.properties

OAuth Configuration file containing information about the necessary client id, secret, access type, etc. Those are all available when you register the app with Zoho. There are also some additional information that the file needs. The file must be in the below shown format with the following properties & their respective values. 

client_id=
client_secret=
redirect_uri=
scope=
access_type=
persistence_handler_class=
mysql_username=
mysql_password=
oauth_tokens_file_path=

  • client_id , client_secret and  redirect_uri  are your OAuth client’s configurations that you get after registering your Zoho client.

  • scope can be one or many (comma separated) valid Zoho CRM scopes. Add  Aaaserver.profile.Read scope along with your other required scopes. It is mandatory.

  • access_type can be set to offline or online.

  • persistence_handler_class is your implementation of the ZohoPersistenceHandler interface, which has handler methods to store OAuth data. This is discussed in the next section.
    For example: persistence_handler_class=com.zoho.oauth.clientapp.ZohoOAuthFilePersistence (or) com.zoho.oauth.clientapp.ZohoOAuthDBPersistence (or) your own persistence handler class.

  • If you prefer to use our DB persistence ( ZohoOAuthDBPersistence.java ) , you need to give the mysql_username and mysql_password keys for mysql connectivity. 
    • By default, mysql_username = root and mysql_password = . 
    • The tokens are generated and placed in the database table automatically(which is explained in the ZohoOauthDBPersistence section) once the authentication process is complete

     
  • In case you're using the File Persistence, the oauth_tokens_file_path  is the relative path to a property file " oauthtokens.properties " that contains the access tokens, refresh tokens etc. The file needs to contain the following properties.

useridentifier=
accesstoken=
refreshtoken=
expirytime=


There is one more property file that needs to be added to the project. 

Configuration - ZCRM

SDK also provides options to override certain HTTP request attributes. These configurations should be provided in this file. Create a similar property file,

zcrm_configuration.properties

The file must be in the below shown format with the following properties & their respective values. 

minLogLevel=
currentUserEmail=
domainSuffix=
accessType=
  • minLogLevel  value represents the minimum log level for the logger prints of SDK. The supported values are ALL, TRACE, DEBUG, INFO, WARNING, ERROR and OFF. The default minimum log level is WARNING.

  • If you are serving multiple users, to allow SDK to identify the specific user who requests, the requester's email address should be set through the following code snippet before making the actual method call of the SDK.
    ZCRMREstClient.setCurrentUser(currentUserEmailId);

  • On the other hand if it is a single user, you can either set the user's email id in ZCRMRestClient (as the one shown above) for every request or you may give the user's email id in  zcrm_configuration.properties  file with the key  currentUserEmail  as a one time configuration.

  • domainSuffix  (optional) - Multi DC support. 

  • accessType  (optional) - Type of environment in CRM

    • Production  - Environment that has active paying users accessing critical business data. 
    • Development  - Environments where you can extend, integrate and develop without affecting your production environments. 
    • Sandbox  - Environments specifically used for testing application functionality before deploying to production or releasing to customers. 

Once both the configuration files are set, you can proceed to procure grant, access and refresh tokens for your application.


    • 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 ...
    • 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 ...
    • 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 ...
    • File Structure Hierarchy - Java SDK

      In your Java IDE setup, create and arrange the packages containing resource files, properties files, and required jars (ZCRMSDK.jar) as displayed in the image. The numbered items shown in the image are the files to be created in a step wise manner.   ...
    • Configuration - Android SDK

      Create a New Project Once your client has been registered, you could start with creating your own Android application. In your command line, move to the directory where you want to create your mobile project and execute the following command. ...