Java SDK Samples - Rest Client Operations
import java.util.List;
import com.zoho.crm.library.api.response.APIResponse;
import com.zoho.crm.library.api.response.BulkAPIResponse;
import com.zoho.crm.library.crud.ZCRMModule;
import com.zoho.crm.library.setup.metadata.ZCRMOrganization;
import com.zoho.crm.library.setup.restclient.ZCRMRestClient;
import com.zoho.crm.library.setup.users.ZCRMProfile;
import com.zoho.crm.library.setup.users.ZCRMRole;
import com.zoho.crm.library.setup.users.ZCRMUser;
public class Rest{
public Rest() throws Exception{
ZCRMRestClient.initialize(configurations_map);
}
public void getOrganizationDetails() throws Exception{
ZCRMRestClient client = ZCRMRestClient.getInstance();
APIResponse response = client.getOrganizationDetails();
ZCRMOrganization org = (ZCRMOrganization) response.getData();
System.out.println(org.getCompanyName());//to get the company name of the organization
System.out.println(org.getOrgId());//to get the organization id of the organization
System.out.println(org.getCountryCode());//to get the country code of the organization
System.out.println(org.getCountry());//to get the the country of the organization
System.out.println(org.getCurrencyLocale());//to get the country locale of the organization
System.out.println(org.getFax());//to get the fax number of the organization
System.out.println(org.getAlias());//to get the alias of the organization
System.out.println(org.getDescription());//to get the description of the organization
System.out.println(org.getStreet());//to get the street name of the organization
System.out.println(org.getCity());//to get the city name of the organization
System.out.println(org.getState());//to get the state of the organization
System.out.println(org.getZgid());//to get the zoho group id of the organization
System.out.println(org.getWebsite());//to get the website of the organization
System.out.println(org.getPrimaryEmail());//to get the primary email of the organization
System.out.println(org.getPrimaryZuid());//to get the primary zoho user id of the organization
System.out.println(org.getIsoCode());//to get the iso code of the organization
System.out.println(org.getPhone());//to get the phone number of the organization
System.out.println(org.getMobile());//to get the mobile number of the organization
System.out.println(org.getEmployeeCount());//to get the employee count of the organization
System.out.println(org.getCurrencySymbol());//to get the currency symbol of the organization
System.out.println(org.getTimeZone());//to get the time zone of the organization
System.out.println(org.getMcStatus());//to get the multicurrency status of the organization
System.out.println(org.isGappsEnabled());//to check whether the google apps is enabled
System.out.println(org.getZipCode());//to get the zip code of the organization
System.out.println(org.isPrivacySettingsEnabled());
}
public static void main(String[] args) throws Exception {
Rest obj=new Rest();
obj.getOrganizationDetails();
}
}
import java.util.List;
import com.zoho.crm.library.api.response.APIResponse;
import com.zoho.crm.library.api.response.BulkAPIResponse;
import com.zoho.crm.library.crud.ZCRMModule;
import com.zoho.crm.library.setup.metadata.ZCRMOrganization;
import com.zoho.crm.library.setup.restclient.ZCRMRestClient;
import com.zoho.crm.library.setup.users.ZCRMProfile;
import com.zoho.crm.library.setup.users.ZCRMRole;
import com.zoho.crm.library.setup.users.ZCRMUser;
public class Rest{
public Rest() throws Exception{
ZCRMRestClient.initialize(configurations_map);
}
public void getCurrentUserEmail() throws Exception{
ZCRMRestClient client = ZCRMRestClient.getInstance();
System.out.println(client.getCurrentUserEmail());
}
public static void main(String[] args) throws Exception {
Rest obj=new Rest();
obj.getCurrentUserEmail();
}
}
import java.util.List;
import com.zoho.crm.library.api.response.APIResponse;
import com.zoho.crm.library.api.response.BulkAPIResponse;
import com.zoho.crm.library.crud.ZCRMModule;
import com.zoho.crm.library.setup.metadata.ZCRMOrganization;
import com.zoho.crm.library.setup.restclient.ZCRMRestClient;
import com.zoho.crm.library.setup.users.ZCRMProfile;
import com.zoho.crm.library.setup.users.ZCRMRole;
import com.zoho.crm.library.setup.users.ZCRMUser;
public class Rest{
public Rest() throws Exception{
ZCRMRestClient.initialize(configurations_map);
}
public void getAllModules() throws Exception{
ZCRMRestClient client = ZCRMRestClient.getInstance();
BulkAPIResponse response = client.getAllModules();
List<ZCRMModule> modules = (List<ZCRMModule>) response.getData();
for(ZCRMModule module : modules){
System.out.println(module.getApiName());
System.out.println(module.getId());
System.out.println(module.getSystemName());
System.out.println(module.getApiName());
System.out.println(module.getSingularLabel());
System.out.println(module.getPluralLabel());
System.out.println(module.isConvertible());
System.out.println(module.isCreatable());
System.out.println(module.isDeletable());
System.out.println(module.isEditable());
System.out.println(module.isViewable());
System.out.println(module.getGeneratedType());
System.out.println(module.getVisibility());
ZCRMUser user=module.getModifiedBy();
if(user!=null){
System.out.println(user.getId());
System.out.println(user.getFullName());
}
List <String> BusinessCards=(module.getBusinessCardFields());
for (String BsuinessCard : BusinessCards) {
System.out.println(BsuinessCard);
}
List <ZCRMProfile> profiles=(module.getAccessibleProfiles());
for(ZCRMProfile profile : profiles){
System.out.println(profile.getId());
System.out.println(profile.getName());
}
}
}
public static void main(String[] args) throws Exception {
Rest obj=new Rest();
obj.getAllModules();
}
}
import java.util.List;
import com.zoho.crm.library.api.response.APIResponse;
import com.zoho.crm.library.api.response.BulkAPIResponse;
import com.zoho.crm.library.crud.ZCRMModule;
import com.zoho.crm.library.setup.metadata.ZCRMOrganization;
import com.zoho.crm.library.setup.restclient.ZCRMRestClient;
import com.zoho.crm.library.setup.users.ZCRMProfile;
import com.zoho.crm.library.setup.users.ZCRMRole;
import com.zoho.crm.library.setup.users.ZCRMUser;
public class Rest{
public Rest() throws Exception{
ZCRMRestClient.initialize(configurations_map);
}
public void getModule() throws Exception{
ZCRMRestClient client = ZCRMRestClient.getInstance();
APIResponse response = client.getModule("Leads");//leads is a module api name
ZCRMModule module = (ZCRMModule)response.getData();
System.out.println(module.getApiName());
System.out.println(module.getId());
System.out.println(module.getSystemName());
System.out.println(module.getApiName());
System.out.println(module.getSingularLabel());
System.out.println(module.getPluralLabel());
System.out.println(module.isConvertible());
System.out.println(module.isCreatable());
System.out.println(module.isDeletable());
System.out.println(module.isEditable());
System.out.println(module.isViewable());
System.out.println(module.getGeneratedType());
System.out.println(module.getVisibility());
ZCRMUser user=module.getModifiedBy();
if(user!=null){
System.out.println(user.getId());
System.out.println(user.getFullName());
}
List <String> BusinessCards=(module.getBusinessCardFields());
for (String BsuinessCard : BusinessCards) {
System.out.println(BsuinessCard);
}
List <ZCRMProfile> profiles=(module.getAccessibleProfiles());
for(ZCRMProfile profile : profiles){
System.out.println(profile.getId());
System.out.println(profile.getName());
}
}
public static void main(String[] args) throws Exception {
Rest obj=new Rest();
obj.getModule();
}
}