A set of scripts used to work with the unofficial, unpublished, and unsupported Zoho Metadata APIs. Use at your own risk, you have been warned!
After you clone the repo, install the required packages using yarn
yarn install
The unofficial api does have any authentication method that we can leverage, so we need to authenticate via the web application and use the credentials from the browser to run the scripts. The bad news is that you need to manually capture the values from the javascript console. The good news is that these credentials are not hard to get and rarely expire. As a reminder, it is not a good security practice to keep these types of credentials stored on your machine.
This is one of many ways to get these credentials, these instructions are for Firefox, but should work with Chrome as well:
- Create a .env file in the root directory of the project and add these variables:
XZCSRFTOKEN=
XCRMORG=
COOKIE=
- Login to Zoho CRM
- Open the Javascript Console (right click > inspect is quick way)
- Navigate to Setup > Developer Space > Functions in Zoho CRM
- Go the the Network tab of the console and search for https://crm.zoho.com/crm/v2/settings/functions
- Right Click on the request and go to Copy > Copy Request Headers
- Paste the headers into a new text file
- Copy paste the corresponding values from the Request Headers to the .env file
XZCSRFTOKEN=<X-ZCSRF-TOKEN> (crmcsrfparam=234j534lds...)
XCRMORG=<X-CRM-ORG> (987654321)
COOKIE=<Cookie> (_iamadt=cdc9c6b1b2e...)
You can test your setup steps using:
yarn run crm:test:auth
yarn run crm:functions:fetch
Creates _AllFunctions.json with all functions and metadata. Also generates a file for each function with the name <Module Name>-<function name>.ds along with comments containing some useful metadata values.
All files stored in the functions directory which is created when first run.
yarn run crm:backups:fetch
Downloads all of the latest backup files and puts them in the backups directory with naming convention: YYYYMMDD_Data_###.zip for data files and YYYYMMDD_Attachments_###.zip. The date in the file prefix is the expiration date of the files' availability.