Copying a Zoho Analytics Workspace using Postman

23.02.22 PM 16:22 PM Автор Alexander

How to copy a Workspace from one account to another

Common scenarios where you might need to copy a Zoho Analytics workspace include:
  • creating a full backup—not just of data, but also of queries and other metadata;
  • setting up a test environment to isolate your developers and provide them with a safe space for experimentation;
  • selling ready-made dashboards to your clients.
The key concept here is the `ZOHO_COPY_DB_KEY`—a key that allows the target account to access metadata from the source account. By using "Self Client" OAuth tokens, you can generate this key from the source account and then use it in the new account with a valid OAuth token.
I hope you find this document a valuable tool in your work.
BEFORE YOU BEGIN
Note: A workspace can only be copied within the same data center. You can identify your data center by the top-level domain:
You will also need to install Postman.
Step 1: Log in to the system
Log in to the source and target accounts in different browsers (e.g., Chrome and Firefox) or in separate Chrome windows.

Step 2. Create Self Clients for each account. 
Create Self Clients for each account using the API Console, based on your data center location.








Step 3. Generate the Code, Client ID, and Client Secret for each account
You will need the Code, Client ID, and Client Secret for Step 4.
To do this, I used `ZohoAnalytics.fullaccess.all` to fill in the Scope field, but you can use a lower-level scope.
You can view the list of all available scopes in Zoho Analytics at this link.

 
In this step, you obtain the Code that will be used in the next step. Copy it: 


You need to perform this step for each account.
As a result of this step, you will obtain the Code, Client ID, and Client Secret for both 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, inserting the values ​​obtained for each account in Step 3.

POST


This step must be performed for each account.
As a result, we obtain access tokens for each account.
Step 5. Generate a Copy DB Key using the source account
Using Postman, send a GET request with the following URL.
Insert the administrator account email address and the workspace name into the selected parameters.
GET


Then, insert the access_token value for the source account from step 4 as a header:





Note: Do not omit the space between `Zoho-oauthtoken` and `access_token`.
This yields the `dbkey` for the next step.
Step 6: Copy the database to the target account

At this stage, the API parameters refer to the SOURCE account, while the OAuth token is for the TARGET account.

Enter the source account's email address (with administrator privileges) and workspace name into the designated parameters, and insert the name of the new workspace for the target account into the ZOHO_DATABASE_NAME parameter.

GET



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


У результаті ми скопіювали робочий простір у цільовий обліковий запис:




I think we can wrap things up here. I successfully use the described approach to copy workspaces from one account to another.
Good luck! 😉😎