ZOHO Partner
ZOHO Partner
ZOHO applications: implementation, training and integration

Copying Zoho Analytics Workspace using Postman

23.02.22 04:22 PM By Alexander

How to copy Workspace from one account to another

Common occasions when you may need to copy your workspace Zoho Analytics:

  • a full backup of not only data, but also queries and other metadata;
  • test environment to isolate your developers and give them a safe space to experiment;
  • sell ready-made dashboards to their clients.

The key concept is ZOHO_COPY_DB_KEY, a key that allows the target account to access metadata from the source account. Using "Self Client" OAuth tokens, you can generate a key from the source account and then use the key in a new account with a valid OAuth token.

I hope you will find this document a valuable tool in your work.
BEFORE YOU START
Warning. Workspace can only be copied within one data centre. You can define your data centre behind the top-level domain:
You will also need to install Postman.
Step 1: Log in

Log in to the source and target accounts in different browsers (e.g. Chrome and Firefox), or in different Chrome windows.

Step 2: Create Self Clients for each account

Create Self Clients for each account using API Console depending on the location of your data center:
https://api-console.zoho.com/ 
https://api-console.zoho.eu/ 
https://api-console.zoho.in/ 








Step 3: Generate Code, Client ID and Client Secret for each account
You will need Code, Client ID, and Client Secret for step 4.
For this I used ZohoAnalytics.fullaccess.all to populate the Scope field, but you can use a lower level Scope.
You can see a list of all available Scope at Zoho Analytics

 
In this step, obtain the Code to be used in the next step. Copy it:


This step must be carried out for each account.

As a result of this step, you will get the Code, Client ID and Client Secret for the source and target accounts.


Step 4: Create OAuth tokens for each account


Using Postman, you need to make two POST requests using the following URL request and placing the resulting values for each account from step 3.

POST

https://accounts.zoho.com/oauth/v2/token?client_id=client_id&code=code&client_secret=client_secret&grant_type=authorization_code



This step must be carried out for each account.

This results in access tokens for each account.
More information: https://www.zoho.com/analytics/api/#oauth
How to create OAuth tokens: https://workdrive.zohoexternal.com/file/7j0ooe272fabba9dc49b9ae6a46d91065c245
Step 5: Generate a Copy DB Key using the original account
Using Postman, you need to make a GET request using the following URL request.
Place the email address of the account with administrator rights, and the name of the workspace in the selected options.
GET
https://analyticsapi.zoho.com/api/email@crmoz/Workspace%20Name?ZOHO_ACTION=GETCOPYDBKEY&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML&ZOHO_API_VERSION=1.0



Then paste the access_token value for the source account from step 4 as the Header:





Note. Do not omit the space in the value between Zoho-oauthtoken and access_token.
The result is the dbkey for the next step.
More information: https://www.zoho.com/analytics/api/#copy-workspace-key
Step 6: Copy the database to the target account

At this point, the settings in the API are for the SOURCE account and the OAuth token is for the PURPOSE account.
Insert the email address of the source account (with administrator privileges), and the workspace name into the selected parameters, and, insert the name of the target account's new worxpace into the ZOHO_DATABASE_NAME parameter.

GET

https://analyticsapi.zoho.com/api/email@crmoz/Workspace%20Name?ZOHO_ACTION=COPYDATABASE&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML&ZOHO_API_VERSION=1.0&ZOHO_DATABASE_NAME=NewWorkspace%20Name&ZOHO_COPY_DB_KEY=dbkey&ZOHO_COPY_WITHDATA=true



Then insert the access_token value for the target account as the Header:


As a result, we copied the worxpace into the target account:




Example API: https://workdrive.zohoexternal.com/file/7j0oo932bb59f77de499daffa36aa13d6fc0f
More information: https://www.zoho.com/analytics/api/#copy-workspace
I think we can call it a day at this point. I have successfully used the described approach to create copies of worxpaces from one account to another.
Good luck 😉😎