To access the CRM services through SDK, the client application must be
first authenticated. This can be done by passing a key-value
configuration pair to the initialization process.
- The $configuration array must be created. It will contain the authentication credentials required.
- The configuration array must then be passed using the "ZCRMRestClient::initialize($configuration); ".
Sample:
- $configuration
=array("client_id"=>{client_id},"client_secret"=>{client_secret},"redirect_uri"=>{redirect_url},"currentUserEmail"=>{user_email_id});
- ZCRMRestClient::initialize($configuration);
Configuration Array
The
user must pass the configuration values as php array(key-value pair) as
argument to the ZCRMRestclient::initialize($configuration); function.
Below is the list of keys that are to be in the array.
Mandatory Keys
| Optional Keys
|
---|
client_id
| applicationLogFilePath
|
client_secret
| sandbox
|
redirect_uri
| apiBaseUrl
|
currentUserEmail
| apiVersion
|
| access_type
|
| accounts_url
|
| persistence_handler_class
|
| token_persistence_path
|
| db_port
|
| db_username
|
| db_password
|
Mandatory properties
- client_id, client_secret and redirect_uri are your OAuth client’s configurations that you get after registering your Zoho client.
- currentUserEmail - In case of single user, this configuration can be set using "ZCRMRestClient::setCurrentUser({user_email_id})".
Note
- The current user email can set in one of two methods. It can be set either:
- Through the "currentUserEmail" key in the configuration array.
- Through the ZCRMRestClient::setCurrentUser({user_email_id}) line in the code.
Additional properties
- access_type must be set to offline only because online OAuth client is not supported by the PHP SDK as of now.
- apiBaseUrl - Url to be used when calling an API. It is used to denote the domain of the user. Url may be:
- www.zohoapis.com (default)
- www.zohoapis.eu
- www.zohoapis.com.cn
- apiVersion is "v2".
- accounts_url - Default value set as US domain. The value can be changed based on your domain(EU,CN).
- accounts.zoho.com
- accounts.zoho.eu
- accounts.zoho.com.cn
- sandbox - To make API calls to sandbox account , please change the value of following key to true. By default the value is false.
- applicationLogFilePath - The SDK stores the log information in a file.
- The
file path of the folder must be specified in the key and the SDK
automatically creates the file. The default file name is the ZCRMClientLibrary.log.
- In case the path isn't specified, the log file will be created inside the project.
- persistence_handler_class is the implementation of the ZohoOAuthPersistenceInterface.
- Refer to this page for more info.
Note
- If the Optional keys are not specified, their default values will be assigned automatically.
- The 'apiBaseUrl' and 'accounts_url' are mandatory in case the user is not in the "com" domain.
Below is an example of a PHP array containing the mandatory keys.
- $configuration
=
array("client_id"=>"value","client_secret"=>"value","redirect_uri"=>"value","currentUserEmail"=>"value");
- ZCRMRestClient::initialize($configuration);
Below is an example of a PHP array containing all the keys.
- $configuration=array("client_id"=>"value","client_secret"=>"value","redirect_uri"=>"value","currentUserEmail"=>"value","applicationLogFilePath"=>"value",
"sandbox"=>"value","apiBaseUrl"=>"value","apiVersion"=>"value",access_type"=>"value","accounts_url"=>"value","persistence_handler_class"=>"value","token_persistence_path"=>"value");
- ZCRMRestClient::initialize($configuration);