PHP SDK Errors and Solutions
The configuration details are not given in configuration.properties and oauth_configuration.properties files.
Set configuration and OAuth configuration properties as displayed in the below image.
The grant token has expired.
SolutionRegenerate grant token and use within the stipulated time.
The user has not included the scope “Aaaserver.profile.Read” while generating the grant token(authorization code).
Include the scope “Aaaserver.profile.Read” while generating the grant token(authorization code).
SSL certificate is not updated.
Download the file from https://curl.haxx.se/ca/cacert.pem and add this line to the php.ini file.
curl.cainfo=“path/to/file/cacert.pem”
Add the below line before $result=curl_exec($curl_pointer) in the firerequest() and downloadFile() methods of ZohoHTTPConnector.php file, and the post() and get() methods of the ZohoOAuthHTTConnector.php file.
curl_setopt($curl_pointer, CURLOPT_SSL_VERIFYPEER, 0);
This solution will bypass the verification of the SSL certificate. Solution 1 is recommended.
The user tries to call an API without generating access and refresh tokens.
Generate access and refresh tokens from grant token.
The email ID of the current user is not specified in configuration map or configuration.properties file.
Enter the email ID of the current user in the configuration.properties file or on the server as shown below.
The SDK is not initialized by not calling ZCRMRestClient::initialize().
Follow the steps mentioned in Initialization - PHP SDK to initialize the SDK.
The user tries to generate grant token and access token from different domains. For example, the user generates the grant token from accounts.zoho.com and tries to generate the access token from accounts.zoho.eu.
Generate both grant token and access token from the same domain.
The user generates access token in a domain but tries to access a record in a different domain. For example, the user generates the access token from www.zohoapis.com and tries to access a module in www.zohoapis.eu
Access the records in the same domain as you generated the access token in, that is, specify the same domain name suffix in accounts_url and apiBaseUrl.
The base url for API is not set in "apiBaseUrl" in the configuration.properties file.
Specify the base URL in "apiBaseUrl" in the configuration.properties file.
The vendor path is not included in the PHP file.
Add the vendor path require ‘vendor/autoload.php’ in the PHP file.
Passing an incorrect object to the method setOwner()
Use the method getData() to get the ZCRM user instance before passing the object to the method setOwner().
The apiBaseUrl key in the configuration dictionary must have had the value as "https://www.zohoapis.com/". The slash at the end of the line is automatically added by the SDK. Hence if the user adds a slash as well, the final input to the SDK will have two slashes. Ex: "https://www.zohoapis.com//".
Remove the (/) slash after https://www.zohoapis.com in the "apiBaseUrl" key of the confirguration dictionary.
The accounts_url key in the configuration dictionary must have had the value as "https://accounts.zoho.com/". The slash at the end of the line is automatically added added by the SDK. Hence if the user adds a slash as well, the final input to the SDK will have two slashes. Ex: "https://accounts.zoho.com//".
Remove the (/) slash after https://accounts.zoho.com in the "accounts_url" key of the configuration dictionary.
The "apiVersion" key in the configuration dictionary is "V2", with a capital "V".
Change the value of apiVersion to "v2" in the configuration dictionary.