Hello everyone!
Welcome to another week of Kaizen. In the last Kaizen post, we discussed Troubleshooting OAuth2.0. By now, you must have got a hold on OAuth2.0 authorization. Now let us dive deep into other details related to OAuth2.0.
What you will learn from this post?
If you want to integrate your application with Zoho CRM, this post will help you understand the different environments available, and how to handle different domains for your application.
In this post, we discuss handling domains for self client. In our upcoming post, we will discuss handling domains for web based clients.
Without further adieu, let us dig deep into each topic.
1. Domains in Zoho CRM
Zoho CRM is hosted at multiple data centers. Therefore, the URL with which you make API calls also depends on the data center. This makes integration simpler. The following are the different domains available.
a. Europe (.eu)
b. Australia (.com.au)
c. India (.in)
d. US (.com)
e. China (.com.cn)
2. Handling Domains for Self Client
In our previous posts, we discussed different types of clients in OAuth Authorization—Self Client and Web Based. In this post, we will discuss handling domains for self client.
2a. Procedure to know your accounts domain via CRM UI
To know in which domain your Zoho CRM account is in, follow the below mentioned steps:
Step 1: Go to Profile and click My Account.
Step 2: In the address bar, you can see your domain. In the below screenshot, the domain is com.
2b. Role of domains while registering the client
While registering your self client, append the domain of your Zoho CRM account (that you noticed in the previous section) to the accounts URL.
This link is your domain-specific accounts URL. For instance, for Europe domain, the domain-specific link is https://api-console.zoho.eu
2c. Making the Authorization Request
After registering your self client, authorize your client to generate grant token. To know how, refer 5th point under How to use Self Client in Kaizen #2.
2d. Role of domains while generating tokens
In the response, along with access and refresh tokens, you will receive "api_domain". Make API calls to Zoho CRM using this domain URL.
- The "api_domain" you receive in the response, is your current api_domain.
- Make all API calls from this api_domain. Example: https://www.zohoapis.eu/crm/v2/Leads will be the URL to fetch all leads from the Leads module in the EU domain.
- Even if the api_domain is altered, it gets updated in the response.
- Store these details in your application DB—access token, refresh token, api_domain, expires_in.
- When the access token expires, you can generate new access token with the refresh tokens–. Update the new access token in your DB and use it to make subsequent API calls.
3. Environments
There are three environments in Zoho CRM.
- Production - The production environment is your live CRM account, which you use for business needs.
Use the following URL to make API calls from the Production environment-https://www.zohoapis.com - Developer - The developer environment is an ideal training ground for developers. You can play around with the CRM account and test robust CRM implementations, Zoho CRM-centric mobile and web apps, white-labelled Vertical CRMs, and CRM extensions. You can have a Developer Edition in parallel with a regular CRM. In essence, two accounts for the same user.
Use the following URL to make API calls from the Developer environment-https://developer.zohoapis.com - Sandbox - In this environment, you can test your Zoho CRM settings before you can take it to your production setup. This way, you can feel much safer about the changes in your settings, since you can test them, identify issues, and fix them before you take them to your actual working setup.
Use the following URL to make API calls from the Sandbox environment-https://sandbox.zohoapis.com
Note:
- The Sandbox environment is available only for the enterprise and above editions.
- If the environment is not specified, the API calls are reflected in the production environment.
- Based on the domain, the URL to make API calls for each environment will vary. For instance, the URL to make API calls from the sandbox environment in Europe domain will be https://sandbox.zohoapis.eu
We hope you found this post useful. Keep a tab on this series for more exciting topics!
Reach out to us at support@zohocrm.com if you have any questions, or let us know in the comment section.
We will meet you next week with another useful topic.
Cheers!