Users APIs
In Zoho CRM, user is the one who is allowed to access and manage the CRM records. These users can be defined under various profiles and categories such as Administrators, Standard, etc,.
Using the Users APIs, you can retrieve the basic information of your available CRM users. Use the type parameter to get the required list of users. For example, you can set the param type as AdminUsers, to get the list of CRM users with Administrative profile. The detailed explanation of the Users API and the examples are shown below:
Get users
Purpose
To retrieve the users data specified in the API request. You can specify the type of users that needs to be retrieved using the Users API. For example, use type=AllUsers, to get the list of all the CRM users available.
Request URL
https://www.zohoapis.com/crm/v2/users
Request Method
GET
Scope
scope=ZohoCRM.users.{operation_type}
| Possible operation types |
|---|
| ALL - Full access to users READ - get user data |
Parameters
| Parameter Name | Data Type | Description |
|---|---|---|
| type | String | AllUsersTo list all users in your organization (both active and inactive users) ActiveUsersTo get the list of all Active Users DeactiveUsersTo get the list of all users who were deactivated ConfirmedUsersTo get the list of confirmed users NotConfirmedUsersTo get the list of non-confirmed users DeletedUsersTo get the list of deleted users ActiveConfirmedUsersTo get the list of active users who are also confirmed AdminUsersTo get the list of admin users. ActiveConfirmedAdminsTo get the list of active users with the administrative privileges and are also confirmed CurrentUserTo get the current CRM user |
| page | Integer | To get the list of user records from the respective pages. Default value is 1. |
| per_page | Integer | To set the number of user records to be retrieved per page. Default value is 200. |
Note:
The page and per_page parameter are used to fetch user records according to their position in the CRM. Let us assume that the user has to fetch 400 user records. The maximum number of user records that one can get for an API call is 200. So, for the user records above the 200th position, they cannot be fetched. By using the page (1 and 2) and per_page (200) parameter, the user can fetch all 400 user records using 2 API calls.
Sample Request
curl "https://www.zohoapis.com/crm/v2/users?type=AllUsers"
-X GET
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf" Sample Response
{
"users": [
{
"country": null,
"role": {
"name": "CEO",
"id": "2445013000000026005"
},
"city": null,
"signature": null,
"name_format": "Salutation,First Name,Last Name",
"language": "en_US",
"locale": "en_US",
"personal_account": true,
"default_tab_group": "0",
"street": null,
"alias": "Charan",
"theme": {
"normal_tab": {
"font_color": "#FFFFFF",
"background": "#222222"
},
"selected_tab": {
"font_color": "#FFFFFF",
"background": "#222222"
},
"new_background": "#018EE0",
"background": "#F3F0EB",
"screen": "fixed",
"type": "default"
},
"id": "2445013000000114007",
"state": null,
"country_locale": "en_US",
"fax": null,
"first_name": "Particia",
"email": "p.boyle@zylker.com",
"zip": null,
"decimal_separator": "en_IN",
"website": null,
"time_format": "hh:mm a",
"profile": {
"name": "Administrator",
"id": "2445013000000026011"
},
"mobile": null,
"last_name": "Boyle",
"time_zone": "IST",
"zuid": "11290182",
"confirm": true,
"full_name": "Patricia Boyle",
"territories": [],
"phone": null,
"dob": null,
"date_format": "MM/dd/yyyy",
"status": "active"
}
],
"info": {
"per_page": 200,
"count": 1,
"page": 1,
"more_records": false
}
} Sample Request
ZCRMRestClient client = ZCRMRestClient.getInstance();
BulkAPIResponse response = client.getOrganizationInstance().getAllUsers();
List<ZCRMUser> users = (List<ZCRMUser>) response.getData(); Sample Response
{
"users": [
{
"country": null,
"role": {
"name": "CEO",
"id": "2445013000000026005"
},
"city": null,
"signature": null,
"name_format": "Salutation,First Name,Last Name",
"language": "en_US",
"locale": "en_US",
"personal_account": true,
"default_tab_group": "0",
"street": null,
"alias": "Charan",
"theme": {
"normal_tab": {
"font_color": "#FFFFFF",
"background": "#222222"
},
"selected_tab": {
"font_color": "#FFFFFF",
"background": "#222222"
},
"new_background": "#018EE0",
"background": "#F3F0EB",
"screen": "fixed",
"type": "default"
},
"id": "2445013000000114007",
"state": null,
"country_locale": "en_US",
"fax": null,
"first_name": "Particia",
"email": "p.boyle@zylker.com",
"zip": null,
"decimal_separator": "en_IN",
"website": null,
"time_format": "hh:mm a",
"profile": {
"name": "Administrator",
"id": "2445013000000026011"
},
"mobile": null,
"last_name": "Boyle",
"time_zone": "IST",
"zuid": "11290182",
"confirm": true,
"full_name": "Patricia Boyle",
"territories": [],
"phone": null,
"dob": null,
"date_format": "MM/dd/yyyy",
"status": "active"
}
],
"info": {
"per_page": 200,
"count": 1,
"page": 1,
"more_records": false
}
} Sample Request
def get_users(self, user_type):
try:
if user_type == 'all':
resp = ZCRMOrganization.get_instance().get_all_users()
elif user_type == 'DeactiveUsers':
resp = ZCRMOrganization.get_instance().get_all_deactive_users()
elif user_type == 'ActiveUsers':
resp = ZCRMOrganization.get_instance().get_all_active_users()
elif user_type == 'ConfirmedUsers':
resp = ZCRMOrganization.get_instance().get_all_confirmed_users()
elif user_type == 'NotConfirmedUsers':
resp = ZCRMOrganization.get_instance().get_all_not_confirmed_users()
elif user_type == 'DeletedUsers':
resp = ZCRMOrganization.get_instance().get_all_deleted_users()
elif user_type == 'ActiveConfirmedUsers':
resp = ZCRMOrganization.get_instance().get_all_active_confirmed_users()
elif user_type == 'AdminUsers':
resp = ZCRMOrganization.get_instance().get_all_admin_users()
elif user_type == 'ActiveConfirmedAdmins':
resp = ZCRMOrganization.get_instance().get_all_active_confirmed_admin_users()
elif user_type == 'CurrentUser':
resp = ZCRMOrganization.get_instance().get_current_user()
print (resp.status_code)
if resp.status_code != 200:
return
users = resp.data
for user in users:
print ("\n\n")
print (user.id)
print (user.name)
print (user.signature)
print (user.country)
crm_role = user.role
if crm_role is not None:
print (crm_role.name)
print (crm_role.id)
customize_info = user.customize_info
if customize_info is not None:
print (customize_info.notes_desc)
print (customize_info.is_to_show_right_panel)
print (customize_info.is_bc_view)
print (customize_info.is_to_show_home)
print (customize_info.is_to_show_detail_view)
print (customize_info.unpin_recent_item)
print (user.city)
print (user.name_format)
print (user.language)
print (user.locale)
print (user.is_personal_account)
print (user.default_tab_group)
print (user.street)
print (user.alias)
user_theme = user.theme
if user_theme is not None:
print (user_theme.normal_tab_font_color)
print (user_theme.normal_tab_background)
print (user_theme.selected_tab_font_color)
print (user_theme.selected_tab_background)
print (user.state)
print (user.country_locale)
print (user.fax)
print (user.first_name)
print (user.email)
print (user.zip)
print (user.decimal_separator)
print (user.website)
print (user.time_format)
crm_profile = user.profile
if crm_profile is not None:
print (crm_profile.id)
print (crm_profile.name)
print (user.mobile)
print (user.last_name)
print (user.time_zone)
print (user.zuid)
print (user.is_confirm)
print (user.full_name)
print (user.phone)
print (user.dob)
print (user.date_format)
print (user.status)
except ZCRMException as ex:
print (ex.status_code)
print (ex.error_message)
print (ex.error_code)
print (ex.error_details)
print (ex.error_content) Sample Response
{
"users": [
{
"country": null,
"role": {
"name": "CEO",
"id": "2445013000000026005"
},
"city": null,
"signature": null,
"name_format": "Salutation,First Name,Last Name",
"language": "en_US",
"locale": "en_US",
"personal_account": true,
"default_tab_group": "0",
"street": null,
"alias": "Charan",
"theme": {
"normal_tab": {
"font_color": "#FFFFFF",
"background": "#222222"
},
"selected_tab": {
"font_color": "#FFFFFF",
"background": "#222222"
},
"new_background": "#018EE0",
"background": "#F3F0EB",
"screen": "fixed",
"type": "default"
},
"id": "2445013000000114007",
"state": null,
"country_locale": "en_US",
"fax": null,
"first_name": "Particia",
"email": "p.boyle@zylker.com",
"zip": null,
"decimal_separator": "en_IN",
"website": null,
"time_format": "hh:mm a",
"profile": {
"name": "Administrator",
"id": "2445013000000026011"
},
"mobile": null,
"last_name": "Boyle",
"time_zone": "IST",
"zuid": "11290182",
"confirm": true,
"full_name": "Patricia Boyle",
"territories": [],
"phone": null,
"dob": null,
"date_format": "MM/dd/yyyy",
"status": "active"
}
],
"info": {
"per_page": 200,
"count": 1,
"page": 1,
"more_records": false
}
} Sample Request
try{
$bulkAPIResponse=ZCRMOrganization::getInstance()->getAllUsers();
$users=$bulkAPIResponse->getData();
foreach($users as $userInstance)
{
echo $userInstance->getCountry();
$roleInstance=$userInstance->getRole();
echo $roleInstance->getId();
echo $roleInstance->getName();
$customizeInstance=$userInstance->getCustomizeInfo();
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();
echo $customizeInstance->getUnpinRecentItem();
echo $customizeInstance->isToShowRightPanel();
echo $customizeInstance->isBcView();
echo $customizeInstance->isToShowHome();
echo $customizeInstance->isToShowDetailView();
}
echo $userInstance->getCity();
echo $userInstance->getSignature();
echo $userInstance->getNameFormat();
echo $userInstance->getLanguage();
echo $userInstance->getLocale();
echo $userInstance->isPersonalAccount();
echo $userInstance->getDefaultTabGroup();
echo $userInstance->getAlias();
echo $userInstance->getStreet();
$themeInstance=$userInstance->getTheme();
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();
echo $themeInstance->getNormalTabBackground();
echo $themeInstance->getSelectedTabFontColor();
echo $themeInstance->getSelectedTabBackground();
}
echo $userInstance->getState();
echo $userInstance->getCountryLocale();
echo $userInstance->getFax();
echo $userInstance->getFirstName();
echo $userInstance->getEmail();
echo $userInstance->getZip();
echo $userInstance->getDecimalSeparator();
echo $userInstance->getWebsite();
echo $userInstance->getTimeFormat();
$profile= $userInstance->getProfile();
echo $profile->getId();
echo $profile->getName();
echo $userInstance->getMobile();
echo $userInstance->getLastName();
echo $userInstance->getTimeZone();
echo $userInstance->getZuid();
echo $userInstance->isConfirm();
echo $userInstance->getFullName();
echo $userInstance->getPhone();
echo $userInstance->getDob();
echo $userInstance->getDateFormat();
echo $userInstance->getStatus();
}
}
catch(ZCRMException $e)
{
echo $e->getMessage();
echo $e->getExceptionCode();
echo $e->getCode();
} Sample Response
{
"users": [
{
"country": null,
"role": {
"name": "CEO",
"id": "2445013000000026005"
},
"city": null,
"signature": null,
"name_format": "Salutation,First Name,Last Name",
"language": "en_US",
"locale": "en_US",
"personal_account": true,
"default_tab_group": "0",
"street": null,
"alias": "Charan",
"theme": {
"normal_tab": {
"font_color": "#FFFFFF",
"background": "#222222"
},
"selected_tab": {
"font_color": "#FFFFFF",
"background": "#222222"
},
"new_background": "#018EE0",
"background": "#F3F0EB",
"screen": "fixed",
"type": "default"
},
"id": "2445013000000114007",
"state": null,
"country_locale": "en_US",
"fax": null,
"first_name": "Particia",
"email": "p.boyle@zylker.com",
"zip": null,
"decimal_separator": "en_IN",
"website": null,
"time_format": "hh:mm a",
"profile": {
"name": "Administrator",
"id": "2445013000000026011"
},
"mobile": null,
"last_name": "Boyle",
"time_zone": "IST",
"zuid": "11290182",
"confirm": true,
"full_name": "Patricia Boyle",
"territories": [],
"phone": null,
"dob": null,
"date_format": "MM/dd/yyyy",
"status": "active"
}
],
"info": {
"per_page": 200,
"count": 1,
"page": 1,
"more_records": false
}
} Sample Request
ZCRMRestClient restClient = ZCRMRestClient.GetInstance();
BulkAPIResponse<ZCRMUser> response = restClient.GetOrganizationInstance().GetAllUsers();
List<ZCRMUser> allUsers = response.BulkData; //response - list of ZCRMUser instances Sample Response
{
"users": [
{
"country": null,
"role": {
"name": "CEO",
"id": "2445013000000026005"
},
"city": null,
"signature": null,
"name_format": "Salutation,First Name,Last Name",
"language": "en_US",
"locale": "en_US",
"personal_account": true,
"default_tab_group": "0",
"street": null,
"alias": "Charan",
"theme": {
"normal_tab": {
"font_color": "#FFFFFF",
"background": "#222222"
},
"selected_tab": {
"font_color": "#FFFFFF",
"background": "#222222"
},
"new_background": "#018EE0",
"background": "#F3F0EB",
"screen": "fixed",
"type": "default"
},
"id": "2445013000000114007",
"state": null,
"country_locale": "en_US",
"fax": null,
"first_name": "Particia",
"email": "p.boyle@zylker.com",
"zip": null,
"decimal_separator": "en_IN",
"website": null,
"time_format": "hh:mm a",
"profile": {
"name": "Administrator",
"id": "2445013000000026011"
},
"mobile": null,
"last_name": "Boyle",
"time_zone": "IST",
"zuid": "11290182",
"confirm": true,
"full_name": "Patricia Boyle",
"territories": [],
"phone": null,
"dob": null,
"date_format": "MM/dd/yyyy",
"status": "active"
}
],
"info": {
"per_page": 200,
"count": 1,
"page": 1,
"more_records": false
}
}