This project provides a set of scripts and utilities to interact with the Zoho Desk API.
It is designed to automate tasks such as account management, SLA application, and data backup.
Please find reference link to the documentation here. Zoho Desk API Documentation
- Authentication: Obtain and refresh OAuth tokens for secure API access.
- Account Management: Read, update, and manage account data.
- SLA Management: Apply and manage SLAs for accounts.
- Backup Utilities: Save and restore backups of account data with metadata.
- Department and View Management: List departments and views for better API interaction.
config/settings.toml: Contains project settings like API URLs.config/secrets.toml: Stores sensitive credentials (ignored in.gitignore). Refer to:sample_secrets.tomlzoho_api/: Contains modules for API interaction, including authentication, account management, and backups.src/: Jupyter Notebooks for utilizing Zoho API.
-
Clone the repository:
git clone https://github.com/PK109/Zoho-Api-scripting-project.git cd Zoho-Api-scripting-project -
Install dependencies:
pip install -r requirements.txt
-
Configure secrets:
- Copy
config/sample_secrets.tomltoconfig/secrets.toml. Valid values can be obtained from Zoho Api Console. - Fill in the required fields (
access_token,refresh_token, etc.).
- Copy
-
Update settings in
config/settings.tomlif necessary. -
If required, install
nbstripoutin the repository to prevent pushing notebook outputs with commits. Instruction on how to perform this operation can be foundhere.
Use the obtain_token or refresh_token functions from zoho_api/auth.py to manage API tokens.
from zoho_api import obtain_token, refresh_token
# Obtain a new token
obtain_token()
# or refresh an existing token
refresh_token()Values obtained from server are updated automatically in secrets.toml.
Read, update, and backup account data using functions from zoho_api/accounts.py.
from zoho_api import read_account, update_account
# Read account details
account_data, response = read_account(account_id="123456789")
# Update account details
update_data = {"accountName": "Updated Name"}
updated_account, response = update_account(account_id="123456789", payload=update_data)Apply SLAs to accounts using the apply_sla function.
from zoho_api import apply_sla
# Apply an SLA to an account
apply_sla(account_id="123456789", sla_id="987654321")Save and load backups using functions from zoho_api/backup.py.
This makes a opportunity to revert changes in the system, if needed.
from zoho_api import save_backup_to_file, load_backup_from_file
# Save a backup
save_backup_to_file(backup_data, filename="backup.json", updated_fields=["field1", "field2"])
# Load a backup
backup_data = load_backup_from_file(filename="backup.json")This project is not affiliated with or endorsed by Zoho Corporation. Use it at your own risk.