<repositories> <repository> <id>java-sdk</id> <url> https://maven.zohodl.com </url> </repository> </repositories> <dependencies> <dependency> <groupId>com.zoho.crm</groupId> <artifactId>java-sdk</artifactId> <version>2.0.2</version> </dependency> </dependencies> |
repositories{ maven { url " https://maven.zohodl.com " } } dependencies{ implementation 'com.zoho.crm:java-sdk:2.0.2' } |
Key | Description |
client_id, client_secret, and redirect_uri mandatory | You can get these values after registering your client. |
currentUserEmail mandatory | The Email ID of the current user. |
persistence_handler_class mandatory | The implementation of ZohoOAuthPersistenceInterface |
logFilePath optional | The absolute/relative file path of the file that stores the logs. |
domainSuffix optional | The domain from which the API calls are made. It can be .com (for US), .eu (for Europe), .cn (for China). If you specify this value, you need not specify apiBaseUrl and iamURL. |
accessType optional | The type of environment from which the API calls are made. Possible values are "Production", "Development", or "Sandbox" |
access_type optional | Must be set as as "offline". Online OAuth client is not supported by the Java SDK as of now |
apiBaseUrl optional | The URL that is used to make API calls. You need not specify this value if you give domainSuffix. The possible values are: https://www.zohoapis.com (default) |
iamURL optional | The accounts URL. You need not specify this value if you specify domainSuffix. The possible values are: |
mysql_password and mysql_username mandatory when you use MySQL persistence | The MySQL username and password, respectively. |
HashMap <String, String> zcrmConfigurations = new HashMap <String, String >(); zcrmConfigurations.put("minLogLevel", "ALL"); zcrmConfigurations.put("currentUserEmail","{user_email_id}"); zcrmConfigurations.put("client_id","1000. xxxxxxxxx"); zcrmConfigurations.put("client_secret","xxxxxxxxxxxx"); zcrmConfigurations.put("redirect_uri",""); zcrmConfigurations.put("persistence_handler_class","com.zoho.oauth.clientapp.ZohoOAuthDBPersistence ");//for database. "com.zoho.oauth.clientapp.ZohoOAuthFilePersistence" for file, user can implement his own persistence and provide the path here zcrmConfigurations.put("oauth_tokens_file_path","/path/to/oauthtokens.properties");//optional path can be absolute(Ex:/User/Document/testapplication/src/oauthtokens.properties) or relative (Ex: /testapplication/src/oauthtokens.properties) zcrmConfigurations.put("domainSuffix","com");//optional. Default is com. "cn", "eu", and "in" supported zcrmConfigurations.put("accessType","Production");//Production->www(default), Development->developer, Sandbox->sandbox(optional) zcrmConfigurations.put("access_type","offline");//optional zcrmConfigurations.put("apiBaseUrl"," https://www.zohoapis.com ");//optional zcrmConfigurations.put("iamURL"," https://accounts.zoho.com ");//optional zcrmConfigurations.put("logFilePath","/path/to/file.log");//path can be absolute(Ex:/User/Document/testapplication/src/file.log) or relative (Ex: /testapplication/src/file.log) zcrmConfigurations.put("mysql_password","pass@123");//optional zcrmConfigurations.put("mysql_username",username");//optional ZCRMRestClient.initialize(zcrmConfigurations);//for initializing |
ZCRMRestClient.initialize(configurations_map); ZohoOAuthClient cli = ZohoOAuthClient.getInstance(); String grantToken = “paste_the_self_authorized_grant_token_here”; ZohoOAuthTokens tokens = cli.generateAccessToken(grantToken); String accessToken = tokens.getAccessToken(); String refreshToken = tokens.getRefreshToken(); System.out.println("access token = " + accessToken + " & refresh token = " + refreshToken); |
ZohoOAuthClient client = ZohoOAuthClient.getInstance(); client.generateAccessTokenFromRefreshToken(refreshToken, userMailId); |
Writer is a powerful online word processor, designed for collaborative work.