PHP SDK Samples - Organization Operations
These sample codes are only applicable for the latest version ( v2.0.0 ) of PHP SDK. Use this link for the previous version samples.
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient
require 'vendor/autoload.php';
class Org{
public function __construct()
{
/* For VERSION <=2.0.6 $configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});*/
$configuration = [];
ZCRMRestClient::initialize($configuration);
}
public function getUser(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$responseIns=$orgIns->getUser("3524033000000191017");//to get the user
$userInstance=$responseIns->getData();//to get the user data in form ZCRMUser instance
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
echo "HTTP Status Code:".$responseIns->getHttpStatusCode(); //To get http response code
echo "Status:".$responseIns->getStatus(); //To get response status
echo "Message:".$responseIns->getMessage(); //To get response message
echo "Code:".$responseIns->getCode(); //To get status code
echo "Details:".json_encode($responseIns->getDetails());
}
}
$obj =new Org();
$obj->getUser();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllUsers(){
/* For VERSION <=2.0.6 $orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$response=$orgIns->getAllUsers();//to get all the user*/
$orgIns = ZCRMOrganization::getInstance(); // to get the organization instance
$param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
$header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
$response = $orgIns->getAllUsers($param_map,$header_map); // to get all the user
$userInstances=$response->getData();//to get the array of users in form of ZCRMUser instances
foreach ($userInstances as $userInstance){
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
}
}
}
$obj =new Org();
$obj->getAllUsers();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllActiveUsers(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
/* For VERSION <=2.0.6 $response=$orgIns->getAllActiveUsers();//to get all the active users*/
$param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
$header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
$response = $orgIns->getAllActiveUsers($param_map,$header_map); // to get all the active users
$userInstances=$response->getData();//to get the array of users in form of ZCRMUser instances
foreach ($userInstances as $userInstance){
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
}
}
}
$obj =new Org();
$obj->getAllActiveUsers();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllDeactiveUsers(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
/* For VERSION <=2.0.6 $response=$orgIns->getAllDeactiveUsers();//to get all the deactivated users */
$param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
$header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
$response = $orgIns->getAllDeactiveUsers($param_map,$header_map); // to get all the deactivated users
$userInstances=$response->getData();//to get the array of users in form of ZCRMUser instances
foreach ($userInstances as $userInstance){
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
}
}
}
$obj =new Org();
$obj->getAllDeactiveUsers();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllConfirmedUsers(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
/* For VERSION <=2.0.6 $response=$orgIns->getAllConfirmedUsers();//to get all the confirmed users*/
$param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
$header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
$response = $orgIns->getAllConfirmedUsers($param_map,$header_map); // to get all the confirmed users
$userInstances=$response->getData();//to get the array of users in form of ZCRMUser instances
foreach ($userInstances as $userInstance){
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
}
}
}
$obj =new Org();
$obj->getAllConfirmedUsers();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllNotConfirmedUsers(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
/* For VERSION <=2.0.6 $response=$orgIns->getAllNotConfirmedUsers();//to get all the nonconfirmed users*/
$param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
$header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
$response = $orgIns->getAllNotConfirmedUsers($param_map,$header_map); // to get all the unconfirmed users
$userInstances=$response->getData();//to get the array of users in form of ZCRMUser instances
foreach ($userInstances as $userInstance){
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
}
}
}
$obj =new Org();
$obj->getAllNotConfirmedUsers();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllDeletedUsers(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
/* For VERSION <=2.0.6 $response=$orgIns->getAllDeletedUsers();//to get all the deleted users*/
$param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
$header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
$response = $orgIns->getAllDeletedUsers($param_map,$header_map); // to get all the deleted users
$userInstances=$response->getData();//to get the array of users in form of ZCRMUser instances
foreach ($userInstances as $userInstance){
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
}
}
}
$obj =new Org();
$obj->getAllDeletedUsers();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllActiveConfirmedUsers(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
/* For VERSION <=2.0.6 $response=$orgIns->getAllActiveConfirmedUsers();//to get all the confirmer active users*/
$param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
$header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
$response = $orgIns->getAllActiveConfirmedUsers($param_map,$header_map); // to get all the active and confirmed users
$userInstances=$response->getData();//to get the array of users in form of ZCRMUser instances
foreach ($userInstances as $userInstance){
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
}
}
}
$obj =new Org();
$obj->getAllActiveConfirmedUsers();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllAdminUsers(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
/* For VERSION <=2.0.6 $response=$orgIns->getAllAdminUsers();//to get all the admins*/
$param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
$header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
$response = $orgIns->getAllAdminUsers($param_map,$header_map); // to get all the administrators
$userInstances=$response->getData();//to get the array of users in form of ZCRMUser instances
foreach ($userInstances as $userInstance){
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
}
}
}
$obj =new Org();
$obj->getAllAdminUsers();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllActiveConfirmedAdmins(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
/* For VERSION <=2.0.6 $response=$orgIns->getAllActiveConfirmedAdmins();//to get all the confirmed admins*/
$param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
$header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
$response = $orgIns->getAllActiveConfirmedAdmins($param_map,$header_map); // to get all the confirmed administrators
$userInstances=$response->getData();//to get the array of users in form of ZCRMUser instances
foreach ($userInstances as $userInstance){
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
}
}
}
$obj =new Org();
$obj->getAllActiveConfirmedAdmins();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getCurrentUser(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$response=$orgIns->getCurrentUser();//to get the current user
$userInstance=$response->getData();//to get the user in form of ZCRMUser instance
$userInstance=$userInstance[0];
echo $userInstance->getId();//to get the user id
echo $userInstance->getCountry();//to get the country of the user
$roleInstance=$userInstance->getRole();//to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId();//to get the role id
echo $roleInstance->getName();//to get the role name
$customizeInstance=$userInstance->getCustomizeInfo();//to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if($customizeInstance!=null)
{
echo $customizeInstance->getNotesDesc();//to get the note description
echo $customizeInstance->getUnpinRecentItem();//to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel();//to check whether the right panel is shown
echo $customizeInstance->isBcView();//to check whether the business card view is enabled
echo $customizeInstance->isToShowHome();//to check whether the home is shown
echo $customizeInstance->isToShowDetailView();//to check whether the detail view is shows
}
echo $userInstance->getCity();//to get the city of the user
echo $userInstance->getSignature();//to get the signature of the user
echo $userInstance->getNameFormat();// to get the name format of the user
echo $userInstance->getLanguage();//to get the language of the user
echo $userInstance->getLocale();//to get the locale of the user
echo $userInstance->isPersonalAccount();//to check whther this is a personal account
echo $userInstance->getDefaultTabGroup();//to get the default tab group
echo $userInstance->getAlias();//to get the alias of the user
echo $userInstance->getStreet();//to get the street name of the user
$themeInstance=$userInstance->getTheme();//to get the theme of the user in form of the ZCRMUserTheme
if($themeInstance!=null)
{
echo $themeInstance->getNormalTabFontColor();//to get the normal tab font color
echo $themeInstance->getNormalTabBackground();//to get the normal tab background
echo $themeInstance->getSelectedTabFontColor();//to get the selected tab font color
echo $themeInstance->getSelectedTabBackground();//to get the selected tab background
}
echo $userInstance->getState();//to get the state of the user
echo $userInstance->getCountryLocale();//to get the country locale of the user
echo $userInstance->getFax();//to get the fax number of the user
echo $userInstance->getFirstName();//to get the first name of the user
echo $userInstance->getEmail();//to get the email id of the user
echo $userInstance->getZip();//to get the zip code of the user
echo $userInstance->getDecimalSeparator();//to get the decimal separator
echo $userInstance->getWebsite();//to get the website of the user
echo $userInstance->getTimeFormat();//to get the time format of the user
$profile= $userInstance->getProfile();//to get the user's profile in form of ZCRMProfile
echo $profile->getId();//to get the profile id
echo $profile->getName();//to get the name of the profile
echo $userInstance->getMobile();//to get the mobile number of the user
echo $userInstance->getLastName();//to get the last name of the user
echo $userInstance->getTimeZone();//to get the time zone of the user
echo $userInstance->getZuid();//to get the zoho user id of the user
echo $userInstance->isConfirm();//to check whether it is a confirmed user
echo $userInstance->getFullName();//to get the full name of the user
echo $userInstance->getPhone();//to get the phone number of the user
echo $userInstance->getDob();//to get the date of birth of the user
echo $userInstance->getDateFormat();//to get the date format
echo $userInstance->getStatus();//to get the status of the user
}
}
$obj =new Org();
$obj->getCurrentUser();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function deleteUser(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$responseIns=$orgIns->deleteUser("{user_id}");//to delete the user
echo "HTTP Status Code:".$responseIns->getHttpStatusCode(); //To get http response code
echo "Status:".$responseIns->getStatus(); //To get response status
echo "Message:".$responseIns->getMessage(); //To get response message
echo "Code:".$responseIns->getCode(); //To get status code
echo "Details:".json_encode($responseIns->getDetails());
}
}
$obj =new Org();
$obj->deleteUser();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
use zcrmsdk\crm\setup\users\ZCRMProfile;
use zcrmsdk\crm\setup\users\ZCRMRole;
use zcrmsdk\crm\setup\users\ZCRMUser;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function createUser(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$user=ZCRMUser::getInstance(NULL, NULL);//to get the user instance
$user->setLastName("subject");//to set the last name of the user
$user->setFirstName("test");//to set the first name of the user
$user->setEmail("test1@gmail.com");//to set the email id of the user
$role=ZCRMRole::getInstance("{role_id}","{role_name}");//to get the role
$user->setRole($role);//to get the role of the user
$profile=ZCRMProfile::getInstance("{profile_id}","{profile_name}");//to get the profile
$user->setProfile($profile);//to set the profile of the user
$responseIns=$orgIns->createUser($user);//to create the user
echo "HTTP Status Code:".$responseIns->getHttpStatusCode(); //To get http response code
echo "Status:".$responseIns->getStatus(); //To get response status
echo "Message:".$responseIns->getMessage(); //To get response message
echo "Code:".$responseIns->getCode(); //To get status code
echo "Details:".json_encode($responseIns->getDetails());
}
}
$obj =new Org();
$obj->createUser();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
use zcrmsdk\crm\setup\users\ZCRMProfile;
use zcrmsdk\crm\setup\users\ZCRMRole;
use zcrmsdk\crm\setup\users\ZCRMUser;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function updateUser(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$user=ZCRMUser::getInstance("{user_id}", "{user_name}");//to get the user instance
$user->setId("{user_id}");//to set the id of the user
$user->setFax("321432423423");//to set the fax number of the user
$user->setMobile("4234234232");//to set the mobile number of the user
$user->setPhone("2342342342");//to set the phone number of the user
$user->setStreet("sddsfdsfd");//to set the street name of the user
$user->setAlias("test");//to set the alias of the user
$user->setWebsite("www.zoho.com");//to set the website of the user
$user->setCity("chennai");//to set the city of the user
$user->setCountry("India");//to set the country of the user
$user->setState("Tamil nadu");//to set the state of the user
$user->setZip("6000010");//to set the zip code of the user
$responseIns=$orgIns->updateUser($user);//to update the user
echo "HTTP Status Code:".$responseIns->getHttpStatusCode(); //To get http response code
echo "Status:".$responseIns->getStatus(); //To get response status
echo "Message:".$responseIns->getMessage(); //To get response message
echo "Code:".$responseIns->getCode(); //To get status code
echo "Details:".json_encode($responseIns->getDetails());
}
}
$obj =new Org();
$obj->updateUser();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllProfiles(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$response=$orgIns->getAllProfiles();//to get the profiles
$profiles=$response->getData();//to get the profiles in form of array of ZCRMProfile
foreach ($profiles as $profile){
echo $profile->getId();//to get the id of the profile
echo $profile->getName();//to get the name of the profile
echo $profile->isDefaultProfile();//to check whether the profile is default
echo $profile->getCreatedTime();//to get the created time of the profile
echo $profile->getModifiedTime();//to get the modified time of the profile
$userInstance=$profile->getModifiedBy();//to get the user who modified the profile
if($userInstance!=NULL){
echo $userInstance->getId();//to get the user id
echo $userInstance->getName();//to get the user name
}
echo $profile->getDescription();//to get the profile description
$userInstance=$profile->getCreatedBy();//to get the user who created the profile
if($userInstance!=NULL){
echo $userInstance->getId();//to get the profile id
echo $userInstance->getName();//to get the profile name
}
echo $profile->getCategory();//to get the category of the profile
$permissions=$profile->getPermissionList();//to get the permissions of the profile
foreach ($permissions as $permission){
echo $permission->getDisplayLabel();//to get the display labnel of the permission
echo $permission->getModule();//to get the module name of the permission
echo $permission->getId();//to get the id of the permission
echo $permission->getName();//to get the name of the permission
echo $permission->isEnabled();//to check whether the permission is enabled
}
$sections=$profile->getSectionsList();//to get the section list of the profile
foreach($sections as $section){
echo $section->getName();//to get the name of the section
$profilecategories=$section->getCategories();//to get the categories of the profile sections
foreach ($profilecategories as $profilecategory){
echo $profilecategory->getName();//to get the name of the category
echo $profilecategory->getModule();//to get the module name to which the category belongs
echo $profilecategory->getDisplayLabel();//to get the display label of the category
$permissionIds= $profilecategory->getPermissionIds();//to get the permission ids of the profile section categories
foreach ($permissionIds as $permissionId){
echo $permissionId;//to get the permission id
}
}
}
}
}
}
$obj =new Org();
$obj->getAllProfiles();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getProfile(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$response=$orgIns->getProfile("{profile_id}");//to get the profile
$profile=$response->getData();//to get the profile in form of the ZCRMProfile instance
echo $profile->getId();//to get the id of the profile
echo $profile->getName();//to get the name of the profile
echo $profile->isDefaultProfile();//to check whether the profile is default
echo $profile->getCreatedTime();//to get the created time of the profile
echo $profile->getModifiedTime();//to get the modified time of the profile
$userInstance=$profile->getModifiedBy();//to get the user who modified the profile
if($userInstance!=NULL){
echo $userInstance->getId();//to get the user id
echo $userInstance->getName();//to get the user name
}
echo $profile->getDescription();//to get the profile description
$userInstance=$profile->getCreatedBy();//to get the user who created the profile
if($userInstance!=NULL){
echo $userInstance->getId();//to get the profile id
echo $userInstance->getName();//to get the profile name
}
echo $profile->getCategory();//to get the category of the profile
$permissions=$profile->getPermissionList();//to get the permissions of the profile
foreach ($permissions as $permission){
echo $permission->getDisplayLabel();//to get the display labnel of the permission
echo $permission->getModule();//to get the module name of the permission
echo $permission->getId();//to get the id of the permission
echo $permission->getName();//to get the name of the permission
echo $permission->isEnabled();//to check whether the permission is enabled
}
$sections=$profile->getSectionsList();//to get the section list of the profile
foreach($sections as $section){
echo $section->getName();//to get the name of the section
$profilecategories=$section->getCategories();//to get the categories of the profile sections
foreach ($profilecategories as $profilecategory){
echo $profilecategory->getName();//to get the name of the category
echo $profilecategory->getModule();//to get the module name to which the category belongs
echo $profilecategory->getDisplayLabel();//to get the display label of the category
$permissionIds= $profilecategory->getPermissionIds();//to get the permission ids of the profile section categories
foreach ($permissionIds as $permissionId){
echo $permissionId;//to get the permission id
}
}
}
}
}
$obj =new Org();
$obj->getProfile();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getAllRoles(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$response=$orgIns->getAllRoles();//to get the roles of the organization
$roles=$response->getData();//to get the roles in form of array of ZCRMRole instances
foreach ($roles as $role){
echo $role->getName();//to get the role name
echo $role->getId();//to get the role id
$reportingrole= $role->getReportingTo();//to get the role id and name to whom user of this role will report to
if($reportingrole!=null){
echo $reportingrole->getId();
echo $reportingrole->getName();
}
echo $role->getDisplayLabel();//to get the display label of the role
echo $role->isAdminRole();//to check whether it is the administrator role
}
}
}
$obj =new Org();
$obj->getAllRoles();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getRole(){
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$response=$orgIns->getRole("{role_id}");//to get the role of the organization
$role=$response->getData();//to get the role in form ZCRMRole instance
echo $role->getName();//to get the role name
echo $role->getId();//to get the role id
$reportingrole= $role->getReportingTo();//to get the role id and name to whom user of this role will report to
if($reportingrole!=null){
echo $reportingrole->getId();
echo $reportingrole->getName();
}
echo $role->getDisplayLabel();//to get the display label of the role
echo $role->isAdminRole();//to check whether it is the administrator role
}
}
$obj =new Org();
$obj->getRole();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getorgtaxes()
{
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$orgTaxes = $orgIns->getOrganizationTaxes()->getData();
foreach ($orgTaxes as $orgTax) {
echo $orgTax->getId() . "\n";
echo $orgTax->getName() . "\n";
echo $orgTax->getDisplayName() . "\n";
echo $orgTax->getValue() . "\n";
}
}
}
$obj =new Org();
$obj->getorgtaxes();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getOrganizationTax()
{
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$orgTax = $orgIns->getOrganizationTax("{organization_tax_id}")->getData();
echo $orgTax->getId() . "\n";
echo $orgTax->getName() . "\n";
echo $orgTax->getDisplayName() . "\n";
echo $orgTax->getValue() . "\n";
}
}
$obj =new Org();
$obj->getOrganizationTax();
<?php
use zcrmsdk\crm\crud\ZCRMOrgTax;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function createOrganizationTaxes()
{
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$orgTax = ZCRMOrgTax::getInstance("fsdf", NULL);
$orgTax->setValue("34");
$orgTaxInstances = array();
array_push($orgTaxInstances, $orgTax);
$responseIns = $orgIns->createOrganizationTaxes($orgTaxInstances);
foreach ($responseIns->getEntityResponses() as $responseIn) {
echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get http response code
echo "Status:" . $responseIn->getStatus(); // To get response status
echo "Message:" . $responseIn->getMessage(); // To get response message
echo "Code:" . $responseIn->getCode(); // To get status code
echo "Details:" . json_encode($responseIn->getDetails());
}
}
}
$obj =new Org();
$obj->createOrganizationTaxes();
<?php
use zcrmsdk\crm\crud\ZCRMOrgTax;
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function updateOrganizationTaxes()
{
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$orgTax = ZCRMOrgTax::getInstance("Salesax","{org_tax_id}");
$orgTax->setValue("33");
$orgTaxInstances = array();
array_push($orgTaxInstances, $orgTax);
$responseIns = $orgIns->updateOrganizationTaxes($orgTaxInstances);
foreach ($responseIns->getEntityResponses() as $responseIn) {
echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get http response code
echo "Status:" . $responseIn->getStatus(); // To get response status
echo "Message:" . $responseIn->getMessage(); // To get response message
echo "Code:" . $responseIn->getCode(); // To get status code
echo "Details:" . json_encode($responseIn->getDetails());
}
}
}
$obj =new Org();
$obj->updateOrganizationTaxes();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function deleteOrganizationTax()
{
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$responseIn = $orgIns->deleteOrganizationTax("{org_tax_id}");
echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
echo "Status:" . $responseIn->getStatus(); // To get response status
echo "Message:" . $responseIn->getMessage(); // To get response message
echo "Code:" . $responseIn->getCode(); // To get status code
echo "Details:" . json_encode($responseIn->getDetails());
}
}
$obj =new Org();
$obj->deleteOrganizationTax();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function deleteOrganizationTaxes()
{
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
$responseIns = $orgIns->deleteOrganizationTaxes($orgTaxids);
foreach ($responseIns->getEntityResponses() as $responseIn) {
echo "HTTP Status Code:" . $responseIns->getHttpStatusCode(); // To get http response code
echo "Status:" . $responseIn->getStatus(); // To get response status
echo "Message:" . $responseIn->getMessage(); // To get response message
echo "Code:" . $responseIn->getCode(); // To get status code
echo "Details:" . json_encode($responseIn->getDetails());
}
}
}
$obj =new Org();
$obj->deleteOrganizationTaxes();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function searchUsersByCriteria()
{
$orgIns = ZCRMRestClient::getOrganizationInstance(); // to get the organization instance
/* For VERSION <=2.0.6 $userInstances = $orgIns->searchUsersByCriteria("{criteria}", "{type}")->getData(); // to get the users of the organization based on criteria and type of the user(active,deleted,etc)*/
$param_map=array("page"=>"1","per_page"=>"200"); // key-value pair containing all the parameters - optional
$userInstances = $orgIns->searchUsersByCriteria("{criteria}", $param_map)->getData(); // to get the users of the organization based on criteria
foreach ($userInstances as $userInstance) {
echo $userInstance->getId(); // to get the user id
echo $userInstance->getCountry(); // to get the country of the user
$roleInstance = $userInstance->getRole(); // to get the role of the user in form of ZCRMRole instance
echo $roleInstance->getId(); // to get the role id
echo $roleInstance->getName(); // to get the role name
$customizeInstance = $userInstance->getCustomizeInfo(); // to get the customization information of the user in for of the ZCRMUserCustomizeInfo form
if ($customizeInstance != null) {
echo $customizeInstance->getNotesDesc(); // to get the note description
echo $customizeInstance->getUnpinRecentItem(); // to get the unpinned recent items
echo $customizeInstance->isToShowRightPanel(); // to check whether the right panel is shown
echo $customizeInstance->isBcView(); // to check whether the business card view is enabled
echo $customizeInstance->isToShowHome(); // to check whether the home is shown
echo $customizeInstance->isToShowDetailView(); // to check whether the detail view is shows
}
echo $userInstance->getCity(); // to get the city of the user
echo $userInstance->getSignature(); // to get the signature of the user
echo $userInstance->getNameFormat(); // to get the name format of the user
echo $userInstance->getLanguage(); // to get the language of the user
echo $userInstance->getLocale(); // to get the locale of the user
echo $userInstance->isPersonalAccount(); // to check whther this is a personal account
echo $userInstance->getDefaultTabGroup(); // to get the default tab group
echo $userInstance->getAlias(); // to get the alias of the user
echo $userInstance->getStreet(); // to get the street name of the user
$themeInstance = $userInstance->getTheme(); // to get the theme of the user in form of the ZCRMUserTheme
if ($themeInstance != null) {
echo $themeInstance->getNormalTabFontColor(); // to get the normal tab font color
echo $themeInstance->getNormalTabBackground(); // to get the normal tab background
echo $themeInstance->getSelectedTabFontColor(); // to get the selected tab font color
echo $themeInstance->getSelectedTabBackground(); // to get the selected tab background
}
echo $userInstance->getState(); // to get the state of the user
echo $userInstance->getCountryLocale(); // to get the country locale of the user
echo $userInstance->getFax(); // to get the fax number of the user
echo $userInstance->getFirstName(); // to get the first name of the user
echo $userInstance->getEmail(); // to get the email id of the user
echo $userInstance->getZip(); // to get the zip code of the user
echo $userInstance->getDecimalSeparator(); // to get the decimal separator
echo $userInstance->getWebsite(); // to get the website of the user
echo $userInstance->getTimeFormat(); // to get the time format of the user
$profile = $userInstance->getProfile(); // to get the user's profile in form of ZCRMProfile
echo $profile->getId(); // to get the profile id
echo $profile->getName(); // to get the name of the profile
echo $userInstance->getMobile(); // to get the mobile number of the user
echo $userInstance->getLastName(); // to get the last name of the user
echo $userInstance->getTimeZone(); // to get the time zone of the user
echo $userInstance->getZuid(); // to get the zoho user id of the user
echo $userInstance->isConfirm(); // to check whether it is a confirmed user
echo $userInstance->getFullName(); // to get the full name of the user
echo $userInstance->getPhone(); // to get the phone number of the user
echo $userInstance->getDob(); // to get the date of birth of the user
echo $userInstance->getDateFormat(); // to get the date format
echo $userInstance->getStatus(); // to get the status of the user
}
}
}
$obj =new Org();
$obj->searchUsersByCriteria();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function getNotes()
{
$org = ZCRMOrganization::getInstance();
/* For VERSION <=2.0.6 $notes = $org->getNotes()->getData(); // to get the notes in form of ZCRMNote instances array */
$param_map=array("page"=>"20","per_page"=>"200"); // key-value pair containing all the parameters - optional
$header_map = array("if-modified-since"=>"2019-11-10T15:26:49+05:30"); // key-value pair containing all the headers - optional
$response = $orgIns->getNotes($param_map,$header_map); // to get all the notes
foreach ($notes as $note) {
echo "\n";
echo $note->getParentModule();
echo $note->getId(); // To get note id
echo $note->getTitle(); // To get note title
echo $note->getContent(); // To get note content
$parentRecord = $note->getParentRecord(); // To get note's parent record
echo $parentRecord->getEntityId(); // To get note's parent record id
echo $note->getParentName(); // To get note's parent name
echo $note->getParentId(); // To get note's parent id
$createdBy = $note->getCreatedBy();
echo $createdBy->getId(); // To get user_id who created the note
echo $createdBy->getName(); // To get user name who created the note
$modifiedBy = $note->getModifiedBy();
echo $modifiedBy->getId(); // To get user_id who modified the note
echo $modifiedBy->getName(); // To get user name who modified the note
$owner = $note->getOwner();
echo $owner->getId(); // To get note_record owner id
echo $owner->getName(); // To get note_record Owner name
echo $note->getCreatedTime(); // To get created time of the note
echo $note->getModifiedTime(); // To get modified time of the note
echo $note->isVoiceNote(); // Check if the note is voice_note or not
echo $note->getSize(); // To get note_record size
$attchments = $note->getAttachments(); // To get attachments of the note_record
if ($attchments != null) // check If attachments is empty/not
{
foreach ($attchments as $attchmentIns) {
echo $attchmentIns->getId(); // To get the note's attachment id
echo $attchmentIns->getFileName(); // To get the note's attachment file name
echo $attchmentIns->getFileType(); // To get the note's attachment file type
echo $attchmentIns->getSize(); // To get the note's attachment file size
echo $attchmentIns->getParentModule(); // To get the note's attachment parent module name
$parentRecord = $attchmentIns->getParentRecord();
echo $parentRecord->getEntityId(); // To get the note's parent record id
echo $attchmentIns->getParentName(); // To get the note name
echo $attchmentIns->getParentId(); // To get the note id
$createdBy = $attchmentIns->getCreatedBy();
echo $createdBy->getId(); // To get user_id who created the note's attachment
echo $createdBy->getName(); // To get user name who created the note's attachment
$modifiedBy = $attchmentIns->getModifiedBy();
echo $modifiedBy->getId(); // To get user_id who modified the note's attachment
echo $modifiedBy->getName(); // To get user name who modified the note's attachment
$owner = $attchmentIns->getOwner();
echo $owner->getId(); // To get the note's attachment owner id
echo $owner->getName(); // To get the note's attachment owner name
echo $attchmentIns->getCreatedTime(); // To get attachment created time
echo $attchmentIns->getModifiedTime(); // To get attachment modified time
}
}
}
}
}
$obj =new Org();
$obj->getNotes();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function createNotes(){
$org = ZCRMOrganization::getInstance();
$record = ZCRMRecord::getInstance("Products", "3524033000003352001");
$noteIns = ZCRMNote::getInstance($record, NULL); // to get the note instance
$noteIns->setTitle("Title_API1"); // to set the note title
$noteIns->setContent("This is test content"); // to set the note content
$noteIns1 = ZCRMNote::getInstance($record, NULL); // to get another note instance
$noteIns1->setTitle("Title_API1"); // to set the note title
$noteIns1->setContent("This is test content");
$noteInstances=[$noteIns,$noteIns1];
$responseIn=$org->createNotes($noteInstances);
foreach ($responseIn->getEntityResponses() as $responseIns) {
echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
echo "Status:" . $responseIns->getStatus(); // To get response status
echo "Message:" . $responseIns->getMessage(); // To get response message
echo "Code:" . $responseIns->getCode(); // To get status code
echo "Details:" . json_encode($responseIns->getDetails());
}
}
}
$obj =new Org();
$obj->createNotes();
<php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public function deleteNotes(){
$org = ZCRMOrganization::getInstance();
$noteIds=["3524033000003392002","3524033000003392001"];
$responseIn=$org->deleteNotes($noteIds);
foreach ($responseIn->getEntityResponses() as $responseIns) {
echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
echo "Status:" . $responseIns->getStatus(); // To get response status
echo "Message:" . $responseIns->getMessage(); // To get response message
echo "Code:" . $responseIns->getCode(); // To get status code
echo "Details:" . json_encode($responseIns->getDetails());
}
}
}
$obj =new Org();
$obj->deleteNotes();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
use zcrmsdk\crm\setup\org\ZCRMOrganization;
use zcrmsdk\crm\crud\ZCRMVariable;
use zcrmsdk\crm\crud\ZCRMVariableGroup;
require 'vendor/autoload.php';
class Org {
public function __construct() {
$configuration = array("client_id" => {client_id}, "client_secret" => {client_secret}, "redirect_uri" => {redirect_url}, "currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public static function getVariables() {
$org_ins = ZCRMOrganization::getInstance();
$variable_instances = $org_ins->getVariables()->getData();
foreach ($variable_instances as $variable_instance) {
echo $variable_instance->getId();
echo $variable_instance->getName();
echo $variable_instance->getApiName();
echo $variable_instance->getType();
echo $variable_instance->getValue();
foreach ($variable_instance->getVariableGroup() as $variable_group) {
echo $variable_group->getId();
echo $variable_group->getName();
}
echo $variable_instance->getDescription();
}
}
}
$obj = new Org();
$obj->getVariables();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
use zcrmsdk\crm\setup\org\ZCRMOrganization;
use zcrmsdk\crm\crud\ZCRMVariable;
use zcrmsdk\crm\crud\ZCRMVariableGroup;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public static function createVariables(){
$variable_array =array() ;
$org_ins=ZCRMOrganization::getInstance();
$variable_ins=ZCRMVariable::getInstance();//to get the rest client
$variable_ins->setName("v");
$variable_ins->setType("integer");
$variable_ins->setValue("2");
$variable_group = ZCRMVariableGroup::getInstance();
$variable_group->setId("3524033000000231001");
$variable_group->setApiName("General");
$variable_ins->setVariableGroup($variable_group);
$variable_ins->setDescription("automated sdk");
array_push($variable_array,$variable_ins);
$variable_ins1=ZCRMVariable::getInstance();//to get the rest client
$variable_ins1->setName("v");
$variable_ins1->setType("integer");
$variable_ins1->setValue("2");
$variable_group = ZCRMVariableGroup::getInstance();
$variable_group->setId("3524033000000231001");
$variable_group->setApiName("General");
$variable_ins1->setVariableGroup($variable_group);
$variable_ins1->setDescription("automated sdk");
array_push($variable_array,$variable_ins1);
$responseIn=$org_ins->createVariables($variable_array);
foreach ($responseIn->getEntityResponses() as $responseIns) {
echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
echo "Status:" . $responseIns->getStatus(); // To get response status
echo "Message:" . $responseIns->getMessage(); // To get response message
echo "Code:" . $responseIns->getCode(); // To get status code
echo "Details:" . json_encode($responseIns->getDetails());
}
}
}
$obj =new Org();
$obj->createVariables();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
use zcrmsdk\crm\setup\org\ZCRMOrganization;
use zcrmsdk\crm\crud\ZCRMVariable;
use zcrmsdk\crm\crud\ZCRMVariableGroup;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public static function updateVariables(){
$variable_array =array() ;
$org_ins=ZCRMOrganization::getInstance();
$variable_ins=ZCRMVariable::getInstance();//to get the rest client
$variable_ins->setId("3524033000002999002");
$variable_ins->setName("x");
$variable_ins->setType("integer");
$variable_ins->setValue("2");
$variable_group = ZCRMVariableGroup::getInstance();
$variable_group->setId("3524033000000231001");
$variable_group->setApiName("General");
$variable_ins->setVariableGroup($variable_group);
$variable_ins->setDescription("automated sdk");
array_push($variable_array,$variable_ins);
$variable_ins1=ZCRMVariable::getInstance();//to get the rest client
$variable_ins1->setName("y");
$variable_ins1->setId("3524033000003000001");
$variable_ins1->setType("integer");
$variable_ins1->setValue("2");
$variable_group = ZCRMVariableGroup::getInstance();
$variable_group->setId("3524033000000231001");
$variable_group->setApiName("General");
$variable_ins1->setVariableGroup($variable_group);
$variable_ins1->setDescription("automated sdk");
array_push($variable_array,$variable_ins1);
$responseIn=$org_ins->updateVariables($variable_array);
foreach ($responseIn->getEntityResponses() as $responseIns) {
echo "HTTP Status Code:" . $responseIn->getHttpStatusCode(); // To get http response code
echo "Status:" . $responseIns->getStatus(); // To get response status
echo "Message:" . $responseIns->getMessage(); // To get response message
echo "Code:" . $responseIns->getCode(); // To get status code
echo "Details:" . json_encode($responseIns->getDetails());
}
}
}
$obj =new Org();
$obj->updateVariables();
<?php
use zcrmsdk\crm\setup\restclient\ZCRMRestClient;
use zcrmsdk\crm\setup\org\ZCRMOrganization;
use zcrmsdk\crm\crud\ZCRMVariable;
use zcrmsdk\crm\crud\ZCRMVariableGroup;
require 'vendor/autoload.php';
class Org{
public function __construct()
{
$configuration = array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
ZCRMRestClient::initialize($configuration);
}
public static function getVariableGroups(){
$org_ins=ZCRMOrganization::getInstance();//to get the rest client
$variable_group_instances = $org_ins->getVariableGroups()->getData();
foreach($variable_group_instances as $variable_group_instance ){
echo $variable_group_instance->getId();
echo $variable_group_instance->getName();
echo $variable_group_instance->getApiName();
echo $variable_group_instance->getDisplayLabel();
echo $variable_group_instance->getDescription();
}
}
}
$obj =new Org();
$obj->getVariableGroups();