Start here
Getting started
Install the SDK, construct a client, and make a first authenticated call.
Install#
Install the gem and require it:
gem build zoho_analytics_client.gemspec
gem install zoho_analytics_client-*.gemrequire 'zoho_analytics_client'Ruby is the one client built with a builder: set the data center and the credentials, then call build.
Register an OAuth client#
- Open the Zoho API Console for your data center.
- Create a Self Client for server-to-server integrations, or a Server-based Application if users will authorise your app themselves.
- Note the Client ID and Client Secret.
- Generate a refresh token with the scopes your integration needs — see Authentication.
Construct the client#
require 'zoho_analytics_client'
ac = AnalyticsClient.new
.with_data_center("US")
.with_oauth({
"clientId" => "1000.xxxxxxx",
"clientSecret" => "xxxxxxx",
"refreshToken" => "1000.xxxxxxx.xxxxxxx"
})
.buildGet a scoped instance#
The client hands out four scoped objects. Each one binds the identifiers it needs, so you do not repeat them on every call.
org = ac.get_org_instance(ORG_ID)
workspace = ac.get_workspace_instance(ORG_ID, WORKSPACE_ID)
view = ac.get_view_instance(ORG_ID, WORKSPACE_ID, VIEW_ID)
bulk = ac.get_bulk_instance(ORG_ID, WORKSPACE_ID)| Instance | Bound to | Use for |
|---|---|---|
OrgAPI | organization | Users, roles, admins, subscription, security controls. |
WorkspaceAPI | organization + workspace | Views, folders, schedules, alerts, backups, sharing. |
ViewAPI | organization + workspace + view | Rows, columns, formulas, publishing. |
BulkAPI | organization + workspace | Importing and exporting data. |
Make a first call#
begin
org = ac.get_org_instance(ORG_ID)
puts org.get_org_workspaces
rescue ServerError => e
puts "Server error #{e.error_code}: #{e.response_content}"
rescue StandardError => e
puts e.message
endA successful call returns the data payload of the response envelope, already decoded. A failure raises or returns ServerError.
Sample response#
{
"status": "success",
"summary": "Get organizations",
"data": {
"orgs": [
{
"orgId": "55522777",
"orgName": "Zylker Analytics",
"orgDesc": "",
"timeZone": "Asia/Kolkata",
"role": "ORGADMIN"
}
]
}
}The SDK unwraps the envelope for you: the value you receive is the contents of data.orgs, not the whole document above.
Where to go next#
- Authentication — read the token throttle section before you ship.
- Errors — what to branch on when a call fails.
- Importing data — the three import modes and when to use each.