Introduction
The Zoho Analytics API allows you to perform most of the operations that you do with our web client.
Zoho Analytics API is built using REST principles, which ensures predictable URLs that make writing applications easy. This API follows HTTP rules, enabling a wide range of HTTP clients can be used to interact with the API.
Every resource is exposed as a URL. The URL of each resource can be obtained by accessing the API Root Endpoint.
Easy to use programming language wrappers called “Client Libraries“ are provided to conveniently use the Zoho Analytics API from within your familiar programming language like Java, C#, Python, PHP, GO and NodeJS.
API Specification
Zoho Analytics API uses HTTP as the underlying transport protocol. It is based on REST principles. The following are the basic points of how the REST APIs are structured:
Every table/report/dashboard in a Zoho Analytics workspace can be uniquely identified using a URL.
The operation to be performed on the table/report/dashboard can be specified using the parameters in the URL.
The additional payload required to perform the operation should also be specified as parameters in the URL.
Every request has a response whose format can be controlled using parameters in the request URL.
It is important to understand the API specification clearly before referring to the actual API methods.
Server URI
The following server URI are available for Zoho Analytics. Choose the server URI based on your data centre.
Sample Request:
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces
--data-urlencode 'CONFIG={
"workspaceName":"<workspace-name>"
}'
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
All API requests should be placed as HTTPS requests. A request consists of the following components:
URI (Universal Resource Identifier. Also commonly known as URL)
Config to be passed in Query String
Authorization Using OAuth 2.0
Organization ID ( can be obtained using Get Organizations API )
URI
The URI of each resource can be obtained by accessing the API Root Endpoint.
Sample: https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces
Config to be passed in Query String
The following snippet shows the config that should be passed as query string with the URI defined above.
https://<end_point>?CONFIG={"workspaceName":"<workspace-name>"}
Authorization Using OAuth 2.0
Access token have to be passed in the header for authorization purpose in the format given below.
Authorization: Zoho-oauthtoken <access_token >
Organization ID
For every organization in Zoho Analytics an unique ID (Organization ID) is present. The header “ZANALYTICS-ORGID“ with the 'Organization ID' should be sent with the API request to identify the organization.
ZANALYTICS-ORGID: <organization_id >
Using Get Organizations API the list of all accessible organizations can be obtained.
Note: In case of importing CSV or JSON files, multipart/form-data format should be used. (This is the default format used by HTML forms that contain file type fields used for uploading files.)
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create workspace" ,
"data" : {
"workspaceId" : "1767024000003145002"
}
}
Zoho Analytics supports JSON response format for APIs. CSV, JSON, XML, PDF, HTML and Image response formats are supported only for Export API.
Note: See this link for response formats in case of errors on API execution.
Formats such as CSV, PDF can be specified only for EXPORT API. These formats don’t have any generic parseable header/footer. See this link for more details about these formats.
Error handling
Sample Error:
HTTP/1.1 400 Bad Request
Content-Type:application/json;charset=UTF-8
{
"status" : "failure" ,
"summary" : "META_DBNAME_DUPLICATE" ,
"data" : {
"errorCode" : 7101,
"errorMessage" : "Workspace with the same name exists already. Provide an alternate name"
}
}
API execution could result in Error conditions. In such cases, follow the below steps to identify an error condition and handle the same:
Check the HTTP response code. If it is 4xx or 5xx (eg., 400, 500, 401, etc.,), then it is an error.
In case of error, the error information would be sent in the response body.
Applying Filter Criteria
Example
(( "Sales"."Region" = 'East' and "Sales" <1000) or ( "Sales"."Region" = 'West' and "Sales" <2000))
Sample
A sample delete request that deletes all the rows that match the criteria
"Sales"."Region"='East' is given below.
URL:
https://analyticsapi.zoho.com/restapi/v2/workspaces/1767025050053160012/views/1769024500004160002/rows?CONFIG={"criteria":"\"Sales\".\"Region\"='East'"}
Zoho Analytics API allows you to apply filter criteria while you execute the various actions. On applying a criteria, the action will be performed only on the data that matches the given filter criteria.
You can apply criteria as part of the following API actions:
Update
Delete
Export
Share
Get View Url
Get Embed Url
Create Private URL
The filter criteria has to be passed as a JSON attribute named “criteria“ in the API request.
The filter criteria that is passed as part of the request, should follow the same format as that of the SQL SELECT WHERE clause.
The generalized format of a simple criteria is given below:
(<columnname/SQL expression/SQL function calls> <relational operator> <value/column name/SQL expression/SQL function calls>)
On using criteria for views which involves multiple tables having the same column name, the criteria should append with the table name to avoid name mismatch.
<tablename>.<columnname> <relational operator> <value/column name/SQL expression/SQL function calls>
Description
The criteria follows the SQL SELECT WHERE condition like format. You could also use SQL in-built functions as part of the criteria. These built-in functions should be the functions supported by any of Oracle, MS SQL Server, MySQL, DB2, Sybase, ANSI SQL, Informix and PostgreSQL databases.
Name
Description
column name
Refers to the column name of your table or query table on which you are applying a criteria.
SQL Expression
You could provide any valid SQL Expression. The above expression subtracts the value in the “Cost” column from the value in the “Sales” column. You could use any of the Arithmetic operators supported in an SQL SELECT WHERE clause. Supported Arithmetic Operators: +, -, *, /
SQL Function call
Oracle, MS SQL Server, MySQL, DB2, Sybase, ANSI SQL, Informix and PostgreSQL databases Eg.: year(date_column) = 2008 . Note: All supported in-built function from different databases will be documented soon.
relational operator
This could be any of the relational operators supported in an SQL SELECT WHERE clause. Supported Relational Operators:= != < > <= >= LIKE NOT LIKE IN NOT IN BETWEEN
value
Refers to the exact value to match. Eg.: "Department" = 'Finance' here 'Finance' is a literal value to match.
You can combine any number of criteria that is defined in the above specified format using logical operators like AND and OR to form complex criteria, the same way as in SQL SELECT WHERE clause. Always use Braces ’()’ to group the criteria for ordering.
Enclose string literals (ie values) in single quotes.
Enclose table name and column name in double quotes.
Eg.: "table_1"."number_column">"table_2"."number_column"
Eg.: "plaintext_column"='country'
Eg.: number_column=75 is valid
Date Format should be either yyyy-mm-dd or yyyy-mm-dd hh:mm:ss
Eg.: "date_column"='2007-01-31 00:00:00'
Currency symbols (or) percent symbol can’t be used in criteria
Eg.: currency_column=75.66 is valid
Eg.: percent_column=100 is valid
currency_column=75.66$ (or) percent_column=100% is not valid
Refer to the SQL SELECT WHERE clause documentation of any database that we support, to know more on how to construct the filter criteria.
View this link for more details about how to construct a custom date format.
Authentication
Zoho Analytics REST API supports OAuth 2.0 protocol to authorize and authenticate API calls. Follow the steps listed here to use OAuth 2.0 protocol in Zoho Analytics APIs.
Registering New Client
Follow the below steps to register with Zoho's Developer console.
Visit DeveloperConsole and click GET STARTED.
Choose Client Type that suits your application type.
Client-based Applications: Applications that are built to run exclusively on browsers independent of web servers.
Server-based Applications: Web-based applications that are built to run with a dedicated HTTP server.NOTE: Server-based applications are chosen when your application is used by multiple users and requires user intervention during authorization.
Mobile-based Applications: Applications that are built to run on smartphones and tablets.
Non-browser Applications: Applications that run on devices without browsers such as smart TVs and printers.
Self Client: For standalone server-side application performing a back-end job, and you do not have a domain and a redirect URL.NOTE: Self Client type is recommended for users using ZohoAnalytics UploadTool and ZohoAnalytics Client Libraries .
After choosing the client type, provide the required details and click 'Create'.
On successful registration, you will be provided with a set of OAuth 2.0 credentials such as <Client_ID> and <Client_Secret> that will be only known to Zoho and your application. (Do not share this credentials anywhere.)
Generating Code
After generating <Client_ID> and <Client_Secret>, a grant code has to be generated. Based on the client type the code can be generated in two ways.
Self Client Method
After registration, click the Self Client method available on the Applications list.
Enter a valid scope. (Refer to Scopes for more details.)
Choose Time Duration. NOTE: Code value generated in this step will be expired after this period. Refresh Token (Step 3 ) have to be generated before the code expires.
Enter Scope Description.
Click CREATE to generate code
Save this code and continue to step 3 .
Redirect Method
The below URL is used to generate code.
https://accounts.zoho.com/oauth/v2/auth?scope=<SCOPE>&client_id=<CLIENT_ID>&state=testing&response_type=code&redirect_uri=<REDIRECT_URI>&access_type=offline&prompt=consent
Make a request to the below URI with the given parameters.
GET https://<ZohoAccounts_Server_URI> /oauth/v2/auth
Parameter Name
Description
scope *
Scope (scope is nothing but a permission to access specific API) for which the token to be generated. Multiple scopes can be given, separated by commas. Example: ZohoAnalytics.data.all,ZohoAnalytics.modeling.create Refer: available scopes
client_id *
<client_id> obtained during Client Registration (Step 1) .
state
An opaque string that is round-tripped in the protocol; ie., whatever value given to this will be passed back to you.
response_type*
code (provide this literal string as the value)
redirect_uri *
One of the redirect URI given in above step. This param should be same redirect url mentioned while registering the Client (Step 1) .
access_type
The allowed values are offline and online. The online access_type gives your application only the access_token which is valid for one hour. The offline access_type will give the application an access_token as well as a refresh_token. By default it is taken as online
prompt
Consent (provide this literal string as the value) Prompts for user consent each time your app tries to access user credentials. If you don't specify this parameter, the user will be prompted only the first time your app requests access.
Note: Fields with * are mandatory
On invoking this request,
If you have already signed in with Zoho, a user consent page will be shown. If you do not have a login session with Zoho, you will be redirected to the Zoho login page. You need to enter your Zoho credentials to login. After authentication the user consent page will be shown.
Upon clicking “Accept”, the application gets authorized. The grant code is sent as a parameter in the redirect_uri.
A back-end script from your end needs to store the following details from the above URL.
code={grant_token} - This is used to generate access and refresh tokens.location={domain} - This tells you the domain of the user from which you have to make API calls.accounts-server={accounts_URL} - This is your accounts URL which you have to use to generate refresh and access tokens .
Note: This code is valid for only 60 seconds. Next Step have to be done within this time.
When the user clicks "Reject", the browser redirects to the redirect URI with the parameter error=access_denied, and your application is denied access to the user's data in Zoho Analytics.
Generating Tokens
REFRESH TOKEN
Refresh token is used to obtain new access tokens. This token has an unlimited lifetime, it can be revoked manually.
ACCESS TOKEN
A token that is sent to the resource server to access the protected resources of the user. Each access token will be valid only for an hour, and can be used only for the set of operations that is described in the scope.
After generating the code, a POST request has to be made for the following URI, with the params given below, to generate refresh_token and access_token.
POST https://<ZohoAccounts_Server_URI> /oauth/v2/token
The below URL is used to generate access token and refresh token.
https://accounts.zoho.com/oauth/v2/token?code=<CODE>&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>&redirect_uri=<REDIRECT_URI>&grant_type=authorization_code
Parameter Name
Description
code*
<code> which is obtained in the above step (Step 2)
client_id*
<client_id> obtained during Client Registration (Step 1)
client_secret*
<client_secret> obtained during Client Registration (Step 1)
redirect_uri
This param should be same redirect url mentioned while adding Client (Step 1) . This param is not required when self client application type is choosen during Client Registration (Step 1) .
grant_type*
authorization_code (provide this literal string as value)
scope
Scope (scope is nothing but a permission to access specific API) for which the token to be generated. Multiple scopes can be given, separated by commas. Example: ZohoAnalytics.data.all,ZohoAnalytics.modeling.create Refer: available scopes
state
An opaque string that is round-tripped in the protocol; that is to say, value will be passed back to the user.
Note: Fields with * are mandatory
1. The <access_token> will expire after an hour.
2. The <refresh_token> is permanent and will be used to regenerate new <access_token>, if the current access token expired.
NOTE: Each time a re-consent page is accepted, a new refresh token is generated. The maximum limit is 20 refresh tokens per user. If this limit is crossed, the first refresh token is automatically deleted to accommodate the latest one. This is done irrespective of whether the first refresh token is in use or not. (You can manually delete a refresh token by revoke request .)
Refreshing Access Tokens
Access Tokens have limited validity, which expires in an hour. Once the access_token expires, user (or) the app will have to use the refresh token to request for a new access token. On using an expired access token, the request terminates throwing Invalid Oauthtoken.
NOTE: A client can create up to ten access tokens in a span of ten minutes, using a refresh token. If the limit is reached, the access token creation will be blocked for the next ten minutes.
The following POST URI with the params given below, generates a new access token.
POST https://<ZohoAccounts_Server_URI> /oauth/v2/token
The below URL is used to Generating Access Token From Refresh Token.
https://accounts.zoho.com/oauth/v2/token?refresh_token=<REFRESH_TOKEN>&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>&redirect_uri=<REDIRECT_URI>&grant_type=refresh_token
Parameter Name
Description
refresh_token*
<refresh_token> which is obtained in the above step (Step 3)
client_id*
<client_id> obtained during Client Registration (Step 1)
client_secret*
<client_secret> obtained during Client Registration (Step 1)
redirect_uri
This param should be same redirect url mentioned while registering Client (Step 1). This param is not required when self client application type is choosen during Client Registration (Step 1) .
grant_type*
refresh_token (provide this literal string as value)
Calling an API using OAuth authentication
Access Token can be passed only in header and cannot be passed in the request param.
Header name = Authorization
Header value = Zoho-oauthtoken<space><access_token>
Sample: Authorization: Zoho-oauthtoken 1000.abcde12345fgh678.ijk9
Revoking a Refresh Token
You may choose to revoke a refresh token manually, when you no longer need access for a particular scope.
Call the following POST URL with the given params to revoke a refresh token.
POST https://<ZohoAccounts_Server_URI> /oauth/v2/token/revoke
Request Example
The below URL is used to revoke the refresh token.
https://accounts.zoho.com/oauth/v2/token/revoke?token=<REFRESH_TOKEN>
Parameter Name
Description
token
<refresh_token> which is to be revoked
SCOPE
Zoho Analytics APIs use selected scopes, which control the type of API's that the client application (or) end user can access. Tokens are usually created with specific scopes to restrict it from acceessing other API's. For example, you can generate a scope to create a view (or) to view metadata and so on.
Scopes contain three parameters — service name, scope name, and operation type.
List of scopes available in Zoho Analytics :
Scope
Description
data
To access data related APIs Availabe Scopes: ZohoAnalytics.data.read, ZohoAnalytics.data.delete, ZohoAnalytics.data.update, ZohoAnalytics.data.create, ZohoAnalytics.data.all
modeling
To access modeling related APIs Availabe Scopes: ZohoAnalytics.modeling.delete, ZohoAnalytics.modeling.update, ZohoAnalytics.modeling.create, ZohoAnalytics.modeling.all
metadata
To access metadata related APIs Availabe Scopes: ZohoAnalytics.metadata.read, ZohoAnalytics.metadata.all
share
To access sharing related APIs Availabe Scopes: ZohoAnalytics.share.delete, ZohoAnalytics.share.read, ZohoAnalytics.share.create, ZohoAnalytics.share.all
embed
To access embed related APIs Availabe Scopes: ZohoAnalytics.embed.read, ZohoAnalytics.embed.all
usermanagement
To access usermanagement related APIs Availabe Scopes: ZohoAnalytics.usermanagement.read, ZohoAnalytics.usermanagement.delete, ZohoAnalytics.usermanagement.update, ZohoAnalytics.usermanagement.create, ZohoAnalytics.usermanagement.all
fullaccess
To access all ZohoAnalytics APIs Availabe Scope: ZohoAnalytics.fullaccess.all
Data API
Data APIs are used to perform addition, update, deletion, bulk import of the Zoho Analytics table data. It also offers APIs to export your tables, reports, dashboards in PDF, Excel, JSON, HTML, Image, and CSV formats.
Add Row
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void AddRow ( IAnalyticsClient ac )
{
Dictionary < string , string > columnValues = new Dictionary < string , string >();
columnValues . Add ( "Region" , "East" );
columnValues . Add ( "Product" , "Test" );
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
Dictionary < string , object > addedInfo = view . AddRow ( columnValues , null );
Console . WriteLine ( addedInfo );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AddRow ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func AddRow ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
columnvalues := map [ string ] interface {}{}
columnvalues [ "Region" ] = "Test"
columnvalues [ "Product Category" ] = "New"
columnvalues [ "Product" ] = "New"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , err := view . AddRow ( columnvalues , config )
if ( err != nil ){
fmt . Println ( "Error - " + err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AddRow ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . addRows ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void addRows ( AnalyticsClient ac ) throws Exception {
JSONObject columnValues = new JSONObject ();
columnValues . put ( "Region" , "East" );
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
JSONObject result = view . addRow ( columnValues , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function addRow () {
$column_values = array ();
$column_values [ "name" ] = "Vincent" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> addRow ( $column_values );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> addRow ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def add_row ( self , ac ):
column_values = {}
column_values [ "Region" ] = "East"
column_values [ "Product Category" ] = "Sample"
column_values [ "Product" ] = "Test"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . add_row ( column_values )
print ( result )
try :
obj = sample ()
obj . add_row ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var columnValues = {};
columnValues [ 'Date' ] = '14/01/2021' ;
columnValues [ 'Region' ] = 'East' ;
columnValues [ "Product Category" ] = 'Furniture' ;
var config = {};
config [ 'dateFormat' ] = 'dd/MM/yyyy' ;
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . addRow ( columnValues , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
columnsMap = Map ();
columnsMap.put ( "Region" , "East" );
columnsMap.put ( "Product" , "Clock" );
columns = Map ();
columns.put ( "columns" , columnsMap );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , columns.toString ());
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/rows"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/rows?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"columns": {
"<column-name1>": "<column-value1>",
"<column-name2>": "<column-value2>"
}
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Add row" ,
"data" : {
"addedColumns" : {
"region" : "East" ,
"Sales" : "1000"
} ,
"invalidColumns" : {}
}
}
Add a single row in the specified table.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/rows
oauthscope: ZohoAnalytics.data.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
columns*
JSONObject JSONObject with column name as key and data as value.Sample: {"columnName1":"value1","columnName2":"value2"}
dateFormat
String Specify this in-case any date field is being added and its format cannot be auto recognized.Sample: dd-MMM-YYYY Refer this link for more details about how to construct a custom date format.
Possible Error Codes
7103 , 7138 , 7507 , 7511 , 8016 , 8504 , 8506 , 8516
Update Row
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void UpdateRow ( IAnalyticsClient ac )
{
Dictionary < string , string > columnValues = new Dictionary < string , string >();
columnValues . Add ( "Region" , "East3" );
columnValues . Add ( "Product" , "C#Test" );
string criteria = "\"Region\"='East3'" ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
Dictionary < string , object > updedInfo = view . UpdateRow ( columnValues , criteria , null );
Console . WriteLine ( updedInfo );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . UpdateRow ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func UpdateRow ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
columnvalues := map [ string ] interface {}{}
columnvalues [ "Region" ] = "Test"
columnvalues [ "Product Category" ] = "Updated"
columnvalues [ "Product" ] = "Updated"
criteria := " \" Region \" ='Test'"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , err := view . UpdateRow ( columnvalues , criteria , config )
if ( err != nil ){
fmt . Println ( "Error - " + err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
UpdateRow ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . updateRows ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void updateRows ( AnalyticsClient ac ) throws Exception {
JSONObject columnValues = new JSONObject ();
columnValues . put ( "Region" , "UpdatedValue" );
String criteria = "\"Region\"='East'" ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
JSONObject result = view . updateRow ( columnValues , criteria , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function updateRow () {
$column_values = array ();
$column_values [ "name" ] = "Vincent" ;
$criteria = " \" age \" ='30'" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> updateRow ( $column_values , $criteria );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> updateRow ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def update_row ( self , ac ):
column_values = {}
column_values [ "Region" ] = "Updated East"
column_values [ "Product Category" ] = "Updated Sample"
column_values [ "Product" ] = "Updated Test"
criteria = " \" Region \" ='East'"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . update_row ( column_values , criteria )
print ( result )
try :
obj = sample ()
obj . update_row ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var columnValues = {};
columnValues [ 'Date' ] = '14/01/2021' ;
columnValues [ 'Region' ] = 'East' ;
columnValues [ "Product Category" ] = 'Furniture' ;
var config = {};
var criteria = "\"Region\"='East'" ;
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . updateRow ( columnValues , criteria , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
columnsMap = Map ();
columnsMap.put ( "Region" , "West" );
columnsMap.put ( "Product" , "Clock" );
config = Map ();
config.put ( "columns" , columnsMap );
criteria = "\"Region\"='East'" ;
config.put ( "criteria" , criteria );
parameters = "CONFIG=" + config.toString ();
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/rows" + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/rows?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"columns": {
"<column-name1>": "<column-value1>",
"<column-name2>": "<column-value2>"
},
"criteria": "\"<table-name>\".\"<column-name>\"='value'"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Update row" ,
"data" : {
"updatedColumns" : {
"region" : "East" ,
"Sales" : "1000"
} ,
"updatedRows" : 27,
"invalidColumns" : {}
}
}
Update rows in the specified table.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/rows
oauthscope: ZohoAnalytics.data.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
columns*
JSONObject JSONObject with column name as key and data as value.Sample: {"columnName1":"value1","columnName2":"value2"}
criteria
String If criteria is sent, then the rows matching the criteria alone are updated.Sample: {"criteria":"\"SalesTable\".\"Region\"='East'"} Refer this link for more details about how to construct a criteria.
updateAllRows
Boolean To update all the rows in the table.
dateFormat
String Specify this in-case any date field is being added and its format cannot be auto recognized.Sample: dd-MMM-YYYY Refer this link for more details about how to construct a custom date format.
Possible Error Codes
7103 , 7138 , 8002 , 8004 , 8504 , 8506 , 8516
Delete Row
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void DeleteRow ( IAnalyticsClient ac )
{
string criteria = "\"Region\"='East3'" ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
int deletedRowCount = view . DeleteRow ( criteria , null );
Console . WriteLine ( deletedRowCount );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . DeleteRow ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func DeleteRow ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
criteria := " \" Region \" ='Test'"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , err := view . DeleteRow ( criteria , config )
if ( err != nil ){
fmt . Println ( "Error - " + err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
DeleteRow ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . deleteRows ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void deleteRows ( AnalyticsClient ac ) throws Exception {
String criteria = "\"Region\"='East'" ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
int result = view . deleteRow ( criteria , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function deleteRow () {
$criteria = " \" name \" ='Vincent'" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> deleteRow ( $criteria );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> deleteRow ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def delete_row ( self , ac ):
criteria = " \" Region \" ='East'"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . delete_row ( criteria )
print ( result )
try :
obj = sample ()
obj . delete_row ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var criteria = "\"Region\"='East'" ;
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . deleteRow ( criteria , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
config = Map ();
criteria = "\"Region\"='East'" ;
config.put ( "criteria" , criteria );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/rows"
type : DELETE
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/rows?CONFIG=<encoded_json_value>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"criteria": "\"<table-name>\".\"<column-name>\"='value'"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Delete row" ,
"data" : {
"deletedRows" : 27
}
}
Delete rows in the specified table.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/rows
oauthscope: ZohoAnalytics.data.delete
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
criteria
String If criteria is sent, then the rows matching the criteria alone are deleted.Sample: {"criteria":"\"SalesTable\".\"Region\"='East'"} Refer this link for more details about how to construct a criteria.
deleteAllRows
Boolean To delete all the rows in the table.
Possible Error Codes
7103 , 7138 , 7507 , 8002 , 8004 , 8016 , 8504 , 8506 , 8516
Error codes in Data API
Sample Error:
HTTP/1.1 400 Bad Request
Content-Type:application/json;charset=UTF-8
{
"status" : "failure" ,
"summary" : "API_NO_COLUMN_PRESENT" ,
"data" : {
"errorCode" : 8016,
"errorMessage" : "You need to have atleast one column for INSERT or UPDATE action"
}
}
This section lists all possible error codes that could be sent from the Zoho Analytics server on failure of Data APIs. You can use this for appropriate error handling.
Error Codes
Error-Code
Reason
Solution
7103
The workspace id mentioned in the API URL does not exist.
Check the workspace id in the request URL and provide a valid Workspace id.
7138
The view id mentioned in the API URL does not exist.
Check the view id in the request URL and provide a valid view id.
7235
Not even a single column name provided in source file matches with the column data in table.
Check whether the column name in source data matches with column names present in analytics table.
NOTE:Also check whether the config fileType is provided with proper value.
7507
Value entered in the mentioned column does not follow the specified data-type.
Check the value of that column and provide value in the specified data-type.
7511
Mentioned Column is a mandatory column.
Should specify the value for that mandatory column.
8002
Specified criteria is invalid.
Provide valid criteria.
8004
The column mentioned in the criteria is not present in the table.
Check the column name and provide valid name.
8016
You need to have at-least one column for INSERT or UPDATE action.
You should provide at-least one column with value.
8504
The required parameter is not proper or has not been sent.
Send the parameter with valid data.
8506
The mentioned parameter has been sent more than the required count.
Check and remove that extra parameter mentioned in the response.
8516
Invalid value passed in the mentioned parameter.
Provide the valid data to the mentioned parameter.
In case of any error other than the above said, mail the API request URL parameters and error response details to support@zohoanalytics.com . Zoho Analytics Team will get back to you with the best possible solution.
Bulk API
Bulk APIs are used to import bulk data into Zoho Analytics table and also offers APIs to export your tables, reports, dashboards in PDF, Excel, JSON, HTML, Image, and CSV formats.
Import Data
Import the provided bulk data in a new table (or) an existing table.
In New Table
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void ImportDataInNewTable ( IAnalyticsClient ac )
{
string tableName = "c#_Import" ;
string fileType = "json" ;
bool autoIdentify = true ;
string filePath = "D:\\sales_v2.json" ;
IBulkAPI data = ac . GetBulkInstance ( orgId , workspaceId );
Dictionary < string , object > importResult = data . ImportDataInNewTable ( tableName , fileType , autoIdentify , filePath , null );
Console . WriteLine ( importResult );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . ImportDataInNewTable ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func ImportDataInNewTable ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
tablename := "v2 go library"
filetype := "json"
autoidentify := "true"
filepath := "/home/local/admin/Files/Sales.json"
bulk := ZAnalytics . GetBulkInstance ( & ac , orgId , workspaceId )
result , err := bulk . ImportDataInNewTable ( tablename , filetype , autoidentify , filepath , config )
if ( err != nil ){
fmt . Println ( "Error - " + err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
ImportDataInNewTable ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . importDataInNewTable ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void importDataInNewTable ( AnalyticsClient ac ) throws Exception {
String tableName = "JAVA Table" ;
String fileType = "csv" ;
boolean autoIdentify = true ;
String filePath = "/home/local/admin/Files/Sales.csv" ;
JSONObject config = new JSONObject ();
BulkAPI data = ac . getBulkInstance ( orgId , workspaceId );
JSONObject response = data . importDataInNewTable ( tableName , fileType , autoIdentify , filePath , config );
System . out . println ( response );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function importDataInNewTable () {
$table_name = "php_import" ;
$file_type = "csv" ;
$auto_identify = "true" ;
$file_path = "/home/local/admin/Files/Sales.csv" ;
$bulk = $this -> ac -> getBulkInstance ( $this -> org_id , $this -> workspace_id );
$response = $bulk -> importDataInNewTable ( $table_name , $file_type , $auto_identify , $file_path );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> importDataInNewTable ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def import_data_in_new_table ( self , ac ):
table_name = "Sales 404"
file_type = "csv"
auto_identify = "true"
file_path = "/home/local/admin/Files/Sales.csv"
bulk = ac . get_bulk_instance ( Config . ORGID , Config . WORKSPACEID )
result = bulk . import_data_in_new_table ( table_name , file_type , auto_identify , file_path )
print ( result )
try :
obj = sample ()
obj . import_data_in_new_table ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var tableName = 'Sales' ;
var fileType = 'csv' ;
var autoIdentify = true ;
var filePath = '/home/local/admin/Files/Sales.csv' ;
var bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . importDataInNewTable ( tableName , fileType , autoIdentify , filePath ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
fileResponse = invokeurl
[
url : ""
type : GET
];
file = fileResponse.toFile ( "Sample.csv" );
file.setParamName ( "FILE" );
config = Map ();
config.put ( "tableName" , "New Table" );
config.put ( "fileType" , "csv" );
config.put ( "autoIdentify" , "true" );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/data" + "?" + parameters
type : POST
headers : headersMap
files : file
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/data?CONFIG=<encoded_json_value>
-F 'FILE=@/home/local/import.csv'
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"tableName": "<table-name>",
"fileType": "csv",
"autoIdentify": "true"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Import data" ,
"data" : {
"viewId" : "1767024000003153002" ,
"importSummary" : {
"importType" : "APPEND" ,
"totalColumnCount" : 7,
"selectedColumnCount" : 7,
"totalRowCount" : 101,
"successRowCount" : 101,
"warnings" : 0,
"importOperation" : "created"
} ,
"columnDetails" : {
"Date" : "Date" ,
"Region" : "Plain Text" ,
"Product Category" : "Plain Text" ,
"Product" : "Plain Text" ,
"Customer Name" : "Plain Text" ,
"Sales" : "Currency" ,
"Cost" : "Currency"
} ,
"importErrors" : ""
}
}
Create a new table and import data on the same.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/data
oauthscope: ZohoAnalytics.data.create
ACTION SPECIFIC PARAMETERS
Parameter Name
Description
FILE (or) DATA*
FILE - The file to be imported.
In the case of importing files multipart/form-data format should be used. (This is the default format used by html forms that contain file type fields used for uploading files) Maximum allowed file size is 20 MB.
DATA - The string to be imported.
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
tableName*
String The name of the table.
fileType*
String The format of the file to be imported.
autoIdentify*
Boolean To specify whether to auto identify the CSV format.
onError
String Controls the action to be taken incase there is an error during import.abort - Incase of any error, abort the whole import. skiprow - In case of any error, skip that specific row(s) which has the problem and continue importing the rest. setcolumnempty - In case of any error, set the value of the error column for the row to empty and continue importing.
selectedColumns
JSONArray Controls the columns that need to be imported.Sample: ["column1","column2"]
skipTop
Integer Number of rows that are to be skipped from the top in the CSV file being imported.
thousandSeparator
Integer Controls the action to be taken in case there is a thousand separator in the data.0 - COMMA 1 - DOT 2 - SPACE 3 - SINGLE QUOTE
decimalSeparator
Integer Controls the action to be taken in case there is a decimal separator in the data.
dateFormat
String Specify this in-case any date field is being imported and its format cannot be auto recognized by Zoho Analytics.Sample: dd-MMM-YYYY Refer this link for more details about how to construct a custom date format.
columnDateFormat
JSONObject Specify this in case multiple date fields are being imported having different format each. Column name as key and date format as value.Sample: {"columnName1":"dd-MMM-YYYY","columnName2":"MM/dd/yyyy"}
CSV Specific Attributes
Note : These attributes are mandatory if autoIdentify is set to false.
Key
Description
commentChar
Char If the character mentioned is found at the beginning of the row, the csv row will be skipped.Sample: #
delimiter
Integer The delimiter character used for separating the fields in a row in the CSV.0 - COMMA 1 - TAB 2 - SEMICOLON 3 - SPACE
quoted
Integer The Text Qualifier.0 - NONE 1 - SINGLE QUOTE 2 - DOUBLE QUOTE
JSON Specific Attributes
Key
Description
retainColumnNames
Boolean Controls how the columns names are to be constructed from the JSON file. Default value - false.true - the final key attribute alone will be considered as column name. false - the column name will be constructed by appending all the parent attributes separated by dot (.). This will result in column names which captures the full JSON tree hierarchy eg., employee.Name, employee.Department
Possible Error Codes
7103 , 7111 , 7232 , 7248 , 7249 , 8046 , 8119 , 8504 , 8506 , 8513 , 8516
In Existing Table
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void ImportData ( IAnalyticsClient ac )
{
string importType = "truncateadd" ;
string fileType = "json" ;
bool autoIdentify = true ;
string filePath = "D:\\sales_v2.json" ;
IBulkAPI data = ac . GetBulkInstance ( orgId , workspaceId );
Dictionary < string , object > importResult = data . ImportData ( viewId , importType , fileType , autoIdentify , filePath , null );
Console . WriteLine ( importResult );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . ImportData ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func ImportData ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
importtype := "append"
filetype := "csv"
autoidentify := "true"
filepath := "/home/local/admin/Files/Sales.csv"
bulk := ZAnalytics . GetBulkInstance ( & ac , orgId , workspaceId )
result , err := bulk . ImportData ( viewId , importtype , filetype , autoidentify , filepath , config )
if ( err != nil ){
fmt . Println ( "Error - " + err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
ImportData ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . importData ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void importData ( AnalyticsClient ac ) throws Exception {
String importType = "TRUNCATEADD" ;
String fileType = "csv" ;
boolean autoIdentify = true ;
String filePath = "/home/local/admin/Files/Sales.csv" ;
JSONObject config = new JSONObject ();
BulkAPI data = ac . getBulkInstance ( orgId , workspaceId );
JSONObject response = data . importData ( viewId , importType , fileType , autoIdentify , filePath , config );
System . out . println ( response );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function importData () {
$import_type = "append" ;
$file_type = "csv" ;
$auto_identify = "true" ;
$file_path = "/home/local/admin/Files/Sales.csv" ;
$bulk = $this -> ac -> getBulkInstance ( $this -> org_id , $this -> workspace_id );
$response = $bulk -> importData ( $this -> view_id , $import_type , $file_type , $auto_identify , $file_path );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> importData ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def import_data ( self , ac ):
import_type = "truncateadd"
file_type = "csv"
auto_identify = "true"
file_path = "/home/local/admin/Files/Sales.csv"
bulk = ac . get_bulk_instance ( Config . ORGID , Config . WORKSPACEID )
result = bulk . import_data ( Config . VIEWID , import_type , file_type , auto_identify , file_path )
print ( result )
try :
obj = sample ()
obj . import_data ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var importType = 'truncateadd' ;
var fileType = 'csv' ;
var autoIdentify = true ;
var filePath = '/home/local/admin/Files/Sales.csv' ;
var bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . importData ( viewId , importType , fileType , autoIdentify , filePath ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
fileResponse = invokeurl
[
url : ""
type : GET
];
file = fileResponse.toFile ( "Sample.csv" );
file.setParamName ( "FILE" );
config = Map ();
config.put ( "importType" , "append" );
config.put ( "fileType" , "csv" );
config.put ( "autoIdentify" , "true" );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/data" + "?" + parameters
type : POST
headers : headersMap
files : file
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/data?CONFIG=<encoded_json_value>
-F 'FILE=@/home/local/import.csv'
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"importType": "append",
"fileType": "csv",
"autoIdentify": "true"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Import data" ,
"data" : {
"importSummary" : {
"importType" : "APPEND" ,
"totalColumnCount" : 7,
"selectedColumnCount" : 7,
"totalRowCount" : 755,
"successRowCount" : 755,
"warnings" : 0,
"importOperation" : "updated"
} ,
"columnDetails" : {
"Date" : "Date" ,
"Region" : "Plain Text" ,
"Product Category" : "Plain Text" ,
"Product" : "Plain Text" ,
"Customer Name" : "Plain Text" ,
"Sales" : "Currency" ,
"Cost" : "Currency"
} ,
"importErrors" : ""
}
}
Import data in the specified table.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/data
oauthscope: ZohoAnalytics.data.create
ACTION SPECIFIC PARAMETERS
Parameter Name
Description
FILE (or) DATA*
FILE - The file to be imported.In the case of importing files multipart/form-data format should be used. (This is the default format used by html forms that contain file type fields used for uploading files) Maximum allowed file size is 20 MB. DATA - The string to be imported.
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
importType*
String Controls the type of import.append - Appends the data into the table. truncateadd - Deletes all exisiting rows in the table and adds the imported data as new entry. updateadd - Updates the row if the mentioned column values are matched, else a new entry will be added.
fileType*
String The format of the file to be imported.
autoIdentify*
Boolean To specify whether to auto identify the CSV format.
onError
String Controls the action to be taken incase there is an error during import.abort - Incase of any error, abort the whole import. skiprow - In case of any error, skip that specific row(s) which has the problem and continue importing the rest. setcolumnempty - In case of any error, set the value of the error column for the row to empty and continue importing.
matchingColumns (mandatory only when the importType is updateadd)
JSONArray The values in the columns to be matched will be used for comparison to check whether data row(s) being imported matches with an existing row(s) in the table. The existing rows in the table that match will be updated with values from data imported. The remaining rows are appended to the table as new rows.Sample: ["column1","column2"]
selectedColumns
JSONArray Controls the columns that need to be imported.Sample: ["column1","column2"]
skipTop
Integer Number of rows that are to be skipped from the top in the CSV file being imported.
thousandSeparator
Integer Controls the action to be taken in case there is a thousand separator in the data.0 - COMMA 1 - DOT 2 - SPACE 3 - SINGLE QUOTE
decimalSeparator
Integer Controls the action to be taken in case there is a decimal separator in the data.
dateFormat
String Specify this in-case any date field is being imported and its format cannot be auto recognized by Zoho Analytics.Sample: dd-MMM-YYYY Refer this link for more details about how to construct a custom date format.
columnDateFormat
JSONObject Specify this in case multiple date fields are being imported having different format each. Column name as key and date format as value.Sample: {"columnName1":"dd-MMM-YYYY","columnName2":"MM/dd/yyyy"}
CSV Specific Attributes
Note : These attributes are mandatory if autoIdentify is set to false.
Key
Description
commentChar
Char If the character mentioned is found at the beginning of the row, the csv row will be skipped.Sample: #
delimiter
Integer The delimiter character used for separating the fields in a row in the CSV.0 - COMMA 1 - TAB 2 - SEMICOLON 3 - SPACE
quoted
Integer The Text Qualifier.0 - NONE 1 - SINGLE QUOTE 2 - DOUBLE QUOTE
JSON Specific Attributes
Note : These attributes are mandatory if autoIdentify is set to false.
Key
Description
retainColumnNames
Boolean Controls how the columns names are to be constructed from the JSON file. Default value - false.true - the final key attribute alone will be considered as column name. false - the column name will be constructed by appending all the parent attributes separated by dot (.). This will result in column names which captures the full JSON tree hierarchy eg., employee.Name, employee.Department
Possible Error Codes
7103 , 7138 , 7232 , 7248 , 7249 , 8046 , 8119 , 8504 , 8506 , 8513 , 8516
Import Data (Asynchronous)
Import the provided bulk data in a new table (or) an existing table in asynchronous manner.
Work flow of Asynchronous Import API is as follows:
Using Create Import Job API, an import job will be created, a JOBID will be returned in the response, which is the reference for the import job. Using Get Import Job Details API, status of the import job can be checked periodically. Upon job completion the system notifies the user in the callback URL (if provided).
Limitations :
The job details will be available for only for one hour from the time of job completion.
Simultaneously 5 import jobs only allowed for an organization.
Create Import Job
Create an import job for importing the provided data in a new table (or) an existing table.
For New Table
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void ImportBulkDataInNewTable ( IAnalyticsClient ac )
{
string tableName = "c#_v2" ;
string fileType = "json" ;
bool autoIdentify = true ;
string filePath = "D:\\sales_v2.json" ;
IBulkAPI data = ac . GetBulkInstance ( orgId , workspaceId );
long jobId = data . ImportBulkDataInNewTable ( tableName , fileType , autoIdentify , filePath , null );
Console . WriteLine ( jobId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . ImportBulkDataInNewTable ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func ImportBulkDataInNewTable ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
tablename := "go lang bulk import"
filetype := "csv"
autoidentify := "true"
filepath := "/home/local/admin/Files/Sales.csv"
bulk := ZAnalytics . GetBulkInstance ( & ac , orgId , workspaceId )
result , err := bulk . ImportBulkDataInNewTable ( tablename , filetype , autoidentify , filepath , config )
if ( err != nil ){
fmt . Println ( "Error - " + err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
ImportBulkDataInNewTable ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . importBulkDataInNewTable ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void importBulkDataInNewTable ( AnalyticsClient ac ) throws Exception {
String tableName = "JAVA Bulk Table" ;
String fileType = "csv" ;
boolean autoIdentify = true ;
String filePath = "/home/local/admin/Files/Sales.csv" ;
JSONObject config = new JSONObject ();
BulkAPI data = ac . getBulkInstance ( orgId , workspaceId );
long jobId = data . importBulkDataInNewTable ( tableName , fileType , autoIdentify , filePath , config );
System . out . println ( jobId );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function importBulkDataInNewTable () {
$table_name = "json1" ;
$file_type = "json" ;
$auto_identify = "true" ;
$file_path = "/home/local/admin/Files/Sales.json" ;
$bulk = $this -> ac -> getBulkInstance ( $this -> org_id , $this -> workspace_id );
$response = $bulk -> importBulkDataInNewTable ( $table_name , $file_type , $auto_identify , $file_path );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> importBulkDataInNewTable ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def import_bulk_data_in_new_table ( self , ac ):
table_name = "Bulk Table"
file_type = "csv"
auto_identify = "true"
file_path = "/home/local/admin/Files/Sales.csv"
bulk = ac . get_bulk_instance ( Config . ORGID , Config . WORKSPACEID )
result = bulk . import_bulk_data_in_new_table ( table_name , file_type , auto_identify , file_path )
print ( result )
try :
obj = sample ()
obj . import_bulk_data_in_new_table ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var tableName = 'W1' ;
var fileType = 'csv' ;
var autoIdentify = true ;
var filePath = '/home/local/admin/Files/Sales.csv' ;
var bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . importBulkDataInNewTable ( tableName , fileType , autoIdentify , filePath ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
fileResponse = invokeurl
[
url : ""
type : GET
];
file = fileResponse.toFile ( "Sample.csv" );
file.setParamName ( "FILE" );
config = Map ();
config.put ( "tableName" , "New Table" );
config.put ( "fileType" , "csv" );
config.put ( "autoIdentify" , "true" );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/" + workspaceId + "/data" + "?" + parameters
type : POST
headers : headersMap
files : file
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/<workspace-id>/data?CONFIG=<encoded_json_value>
-F 'FILE=@/home/local/import.csv'
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"tableName": "<table-name>",
"fileType": "csv",
"autoIdentify": "true"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create bulk import job" ,
"data" : {
"jobId" : "1767024000003153087"
}
}
Create an import job to import data in a new table.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/bulk/workspaces/<workspace-id>/data
oauthscope: ZohoAnalytics.data.create
ACTION SPECIFIC PARAMETERS
Parameter Name
Description
FILE*
File The file to be imported.
Format should be multipart/form-data. (This is the default format used by html forms that contain file type fields used for uploading files) Maximum allowed file size is 100 MB.
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
tableName*
String The name of the table.
fileType*
String The format of the file to be imported.
autoIdentify*
Boolean To specify whether to auto identify the CSV format.
onError
String Controls the action to be taken incase there is an error during import.abort - Incase of any error, abort the whole import. skiprow - In case of any error, skip that specific row(s) which has the problem and continue importing the rest. setcolumnempty - In case of any error, set the value of the error column for the row to empty and continue importing.
selectedColumns
JSONArray Controls the columns that need to be imported.Sample: ["column1","column2"]
skipTop
Integer Number of rows that are to be skipped from the top in the CSV file being imported.
thousandSeparator
Integer Controls the action to be taken in case there is a thousand separator in the data.0 - COMMA 1 - DOT 2 - SPACE 3 - SINGLE QUOTE
decimalSeparator
Integer Controls the action to be taken in case there is a decimal separator in the data.
dateFormat
String Specify this in-case any date field is being imported and its format cannot be auto recognized by Zoho Analytics.Sample: dd-MMM-YYYY Refer this link for more details about how to construct a custom date format.
columnDateFormat
JSONObject Specify this in case multiple date fields are being imported having different format each. Column name as key and date format as value.Sample: {"columnName1":"dd-MMM-YYYY","columnName2":"MM/dd/yyyy"}
callbackUrl
String A valid URL, that should allow HTTP Post method. The Bulk Import Job's details is posted to this URL on successful completion of job or on failure of job.
CSV Specific Attributes
Note : These attributes are mandatory if autoIdentify is set to false.
Key
Description
commentChar
Char If the character mentioned is found at the beginning of the row, the csv row will be skipped.Sample: #
delimiter
Integer The delimiter character used for separating the fields in a row in the CSV.0 - COMMA 1 - TAB 2 - SEMICOLON 3 - SPACE
quoted
Integer The Text Qualifier.0 - NONE 1 - SINGLE QUOTE 2 - DOUBLE QUOTE
JSON Specific Attributes
Key
Description
retainColumnNames
Boolean Controls how the columns names are to be constructed from the JSON file. Default value - false.true - the final key attribute alone will be considered as column name. false - the column name will be constructed by appending all the parent attributes separated by dot (.). This will result in column names which captures the full JSON tree hierarchy eg., employee.Name, employee.Department
Possible Error Codes
7103 , 7111 , 7232 , 7248 , 7249 , 8046 , 8119 , 8504 , 8506 , 8513 , 8516
For Existing Table
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void ImportBulkData ( IAnalyticsClient ac )
{
string importType = "append" ;
string fileType = "json" ;
bool autoIdentify = true ;
string filePath = "D:\\sales_v2.json" ;
IBulkAPI data = ac . GetBulkInstance ( orgId , workspaceId );
long jobId = data . ImportBulkData ( viewId , importType , fileType , autoIdentify , filePath , null );
Console . WriteLine ( jobId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . ImportBulkData ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func ImportBulkData ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
importtype := "truncateadd"
filetype := "csv"
autoidentify := "true"
filepath := "/home/local/admin/Files/Sales.csv"
bulk := ZAnalytics . GetBulkInstance ( & ac , orgId , workspaceId )
result , err := bulk . ImportBulkData ( viewId , importtype , filetype , autoidentify , filepath , config )
if ( err != nil ){
fmt . Println ( "Error - " + err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
ImportBulkData ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . importBulkData ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void importBulkData ( AnalyticsClient ac ) throws Exception {
String importType = "TRUNCATEADD" ;
String fileType = "csv" ;
boolean autoIdentify = true ;
String filePath = "/home/local/admin/Files/Sales.csv" ;
JSONObject config = new JSONObject ();
BulkAPI data = ac . getBulkInstance ( orgId , workspaceId );
long jobId = data . importBulkData ( viewId , importType , fileType , autoIdentify , filePath , config );
System . out . println ( jobId );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function importBulkData () {
$import_type = "truncateadd" ;
$file_type = "csv" ;
$auto_identify = "true" ;
$file_path = "/home/local/admin/Files/Sales.csv" ;
$bulk = $this -> ac -> getBulkInstance ( $this -> org_id , $this -> workspace_id );
$response = $bulk -> importBulkData ( $this -> view_id , $import_type , $file_type , $auto_identify , $file_path );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> importBulkData ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def import_bulk_data ( self , ac ):
import_type = "truncateadd"
file_type = "csv"
auto_identify = "true"
file_path = "/home/local/admin/Files/Sales.csv"
bulk = ac . get_bulk_instance ( Config . ORGID , Config . WORKSPACEID )
result = bulk . import_bulk_data ( Config . VIEWID , import_type , file_type , auto_identify , file_path )
print ( result )
try :
obj = sample ()
obj . import_bulk_data ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var importType = 'append' ;
var fileType = 'csv' ;
var autoIdentify = true ;
var filePath = '/home/local/admin/Files/Sales.csv' ;
var bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . importBulkData ( viewId , importType , fileType , autoIdentify , filePath ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
fileResponse = invokeurl
[
url : ""
type : GET
];
file = fileResponse.toFile ( "Sample.csv" );
file.setParamName ( "FILE" );
config = Map ();
config.put ( "importType" , "append" );
config.put ( "fileType" , "csv" );
config.put ( "autoIdentify" , "true" );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/" + workspaceId + "/views/" + viewId + "/data" + "?" + parameters
type : POST
headers : headersMap
files : file
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/<workspace-id>/views/<view-id>/data?CONFIG=<encoded_json_value>
-F 'FILE=@/home/local/import.csv'
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"importType": "append",
"fileType": "csv",
"autoIdentify": "true"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create bulk import job" ,
"data" : {
"jobId" : "1757024000003153087"
}
}
Create an import job to import data in the specified table.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/bulk/workspaces/<workspace-id>/views/<view-id>/data
oauthscope: ZohoAnalytics.data.create
ACTION SPECIFIC PARAMETERS
Parameter Name
Description
FILE*
File The file to be imported.
Format should be multipart/form-data. (This is the default format used by html forms that contain file type fields used for uploading files) Maximum allowed file size is 100 MB.
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
importType*
String Controls the type of import.append - Appends the data into the table. truncateadd - Deletes all exisiting rows in the table and adds the imported data as new entry. updateadd - Updates the row if the mentioned column values are matched, else a new entry will be added.
fileType*
String The format of the file to be imported.
autoIdentify*
Boolean To specify whether to auto identify the CSV format.
onError
String Controls the action to be taken incase there is an error during import.abort - Incase of any error, abort the whole import. skiprow - In case of any error, skip that specific row(s) which has the problem and continue importing the rest. setcolumnempty - In case of any error, set the value of the error column for the row to empty and continue importing.
matchingColumns (mandatory only when the importType is updateadd)
JSONArray The values in the columns to be matched will be used for comparison to check whether data row(s) being imported matches with an existing row(s) in the table. The existing rows in the table that match will be updated with values from data imported. The remaining rows are appended to the table as new rows.Sample: ["column1","column2"]
selectedColumns
JSONArray Controls the columns that need to be imported.Sample: ["column1","column2"]
skipTop
Integer Number of rows that are to be skipped from the top in the CSV file being imported.
thousandSeparator
Integer Controls the action to be taken in case there is a thousand separator in the data.0 - COMMA 1 - DOT 2 - SPACE 3 - SINGLE QUOTE
decimalSeparator
Integer Controls the action to be taken in case there is a decimal separator in the data.
dateFormat
String Specify this in-case any date field is being imported and its format cannot be auto recognized by Zoho Analytics.Sample: dd-MMM-YYYY Refer this link for more details about how to construct a custom date format.
columnDateFormat
JSONObject Specify this in case multiple date fields are being imported having different format each. Column name as key and date format as value.Sample: {"columnName1":"dd-MMM-YYYY","columnName2":"MM/dd/yyyy"}
callbackUrl
String A valid URL, that should allow HTTP Post method. The Bulk Import Job's details is posted to this URL on successful completion of job or on failure of job.
CSV Specific Attributes
Note : These attributes are mandatory if autoIdentify is set to false.
Key
Description
commentChar
Char If the character mentioned is found at the beginning of the row, the csv row will be skipped.Sample: #
delimiter
Integer The delimiter character used for separating the fields in a row in the CSV.0 - COMMA 1 - TAB 2 - SEMICOLON 3 - SPACE
quoted
Integer The Text Qualifier.0 - NONE 1 - SINGLE QUOTE 2 - DOUBLE QUOTE
JSON Specific Attributes
Note : These attributes are mandatory if autoIdentify is set to false.
Key
Description
retainColumnNames
Boolean Controls how the columns names are to be constructed from the JSON file. Default value - false.true - the final key attribute alone will be considered as column name. false - the column name will be constructed by appending all the parent attributes separated by dot (.). This will result in column names which captures the full JSON tree hierarchy eg., employee.Name, employee.Department
Possible Error Codes
7103 , 7111 , 7138 , 7232 , 7248 , 7249 , 8046 , 8119 , 8504 , 8506 , 8513 , 8516
Get Import Job Details
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetImportJobDetails ( IAnalyticsClient ac )
{
long jobId = 35130000001356005 ;
IBulkAPI data = ac . GetBulkInstance ( orgId , workspaceId );
Dictionary < string , object > jobInfo = data . GetImportJobDetails ( jobId );
Console . WriteLine ( jobInfo );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetImportJobDetails ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetImportJobDetails ( ac ZAnalytics . Client ) {
jobid := "35130000001345001"
bulk := ZAnalytics . GetBulkInstance ( & ac , orgId , workspaceId )
result , err := bulk . GetImportJobDetails ( jobid )
if ( err != nil ){
fmt . Println ( err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetImportJobDetails ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getImportJobDetails ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getImportJobDetails ( AnalyticsClient ac ) throws Exception {
long jobId = 35130000001343088 l ;
BulkAPI data = ac . getBulkInstance ( orgId , workspaceId );
JSONObject jobInfo = data . getImportJobDetails ( jobId );
System . out . println ( jobInfo );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getImportJobDetails () {
$job_id = "35130000001342088" ;
$bulk = $this -> ac -> getBulkInstance ( $this -> org_id , $this -> workspace_id );
$response = $bulk -> getImportJobDetails ( $job_id );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getImportJobDetails ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_import_job_details ( self , ac ):
job_id = "35130000001336083"
bulk = ac . get_bulk_instance ( Config . ORGID , Config . WORKSPACEID )
result = bulk . get_import_job_details ( job_id )
print ( result )
try :
obj = sample ()
obj . get_import_job_details ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var jobId = '' ;
var bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . getImportJobDetails ( jobId ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
jobId = "5888000000222090" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/" + workspaceId + "/importjobs/" + jobId
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/<workspace-id>/importjobs/<job-id>
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Fetch import job info" ,
"data" : {
"jobId" : "1767024000003153087" ,
"jobCode" : "1004" ,
"jobStatus" : "JOB COMPLETED" ,
"jobInfo" : {
"viewId" : "1767024000003154002" ,
"importSummary" : {
"importType" : "APPEND" ,
"totalColumnCount" : 7,
"selectedColumnCount" : 7,
"totalRowCount" : 755,
"successRowCount" : 755,
"warnings" : 0,
"importOperation" : "created"
} ,
"columnDetails" : {
"Date" : "Date" ,
"Region" : "Plain Text" ,
"Product Category" : "Plain Text" ,
"Product" : "Plain Text" ,
"Customer Name" : "Plain Text" ,
"Sales" : "Currency" ,
"Cost" : "Currency"
} ,
"importErrors" : ""
} ,
"expiryTime" : "1623764592309"
}
}
Returns details of the specified import job.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/bulk/workspaces/<workspace-id>/importjobs/<job-id>
oauthscope: ZohoAnalytics.data.create
Possible Error Codes
7103 , 8137 , 8138
Export Data
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void ExportData ( IAnalyticsClient ac )
{
string responseFormat = "json" ;
string filePath = "D:\\sales_v2.json" ;
IBulkAPI data = ac . GetBulkInstance ( orgId , workspaceId );
data . ExportData ( viewId , responseFormat , filePath , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . ExportData ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35130000001055707"
)
func ExportData ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
responseformat := "pdf"
filepath := "/home/local/admin/Files/Sales.pdf"
bulk := ZAnalytics . GetBulkInstance ( & ac , orgId , workspaceId )
exception := bulk . ExportData ( viewId , responseformat , filepath , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
ExportData ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . exportData ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void exportData ( AnalyticsClient ac ) throws Exception {
String responseFormat = "csv" ;
String filePath = "/home/local/admin/Files/Sales.csv" ;
BulkAPI bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . exportData ( viewId , responseFormat , filePath , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function exportData () {
$response_format = "csv" ;
$file_path = "/home/local/admin/Files/Sales.csv" ;
$bulk = $this -> ac -> getBulkInstance ( $this -> org_id , $this -> workspace_id );
$bulk -> exportData ( $this -> view_id , $response_format , $file_path );
}
}
$test_obj = new Test ();
try {
$test_obj -> exportData ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def export_data ( self , ac ):
response_format = "csv"
file_path = "/home/local/admin/Files/Sales.csv"
bulk = ac . get_bulk_instance ( Config . ORGID , Config . WORKSPACEID )
bulk . export_data ( Config . VIEWID , response_format , file_path )
try :
obj = sample ()
obj . export_data ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var responseFormat = 'csv' ;
var filePath = '/home/local/admin/Files/Sales.csv' ;
var bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . exportData ( viewId , responseFormat , filePath ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
config = Map ();
config.put ( "responseFormat" , "csv" );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/data"
type : GET
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/data?CONFIG=<encoded_json_value>
-X 'GET'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"responseFormat": "csv"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:text/csv;charset=UTF-8
Date,Region,Product,Customer Name,Sales
"15 June, 2021" ,East,Cereals,Vincent Herbert,682.39
"15 June, 2021" ,West,Clocks,John Britto,$272.34
"15 June, 2021" ,Central,Art Supplies,Susan Juliet,$45.31
Export data from the specified view.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/data
oauthscope: ZohoAnalytics.data.read
Note: Export Data API is restricted for certain resources ( given below ). For the same kindly use Asynchronous Export APIs for exporting data.Tables having more than one million rows. Tables and Views from live connect workspaces. Dashboard and Querytable view types.
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
responseFormat*
String The format of the data to be exported.
criteria
String If criteria is sent, then the rows matching the criteria alone are exported.Sample: {"criteria":"\"SalesTable\".\"Region\"='East'"} Refer this link for more details about how to construct a criteria.
selectedColumns
JSONArray Controls the columns that need to be exported.Sample: ["column1","column2"]
showHiddenCols
Boolean Controls whether the columns that have been hidden in the table have to be exported. Default value - false.
showPersonalCols
Boolean Controls whether the columns that have been marked as personal data in the table have to be exported. Default value - false.
generateTOC
Boolean To generate Table Of Contents.Only for dashboards Default value - false.
dashboardLayout
Integer Layout type of the dashboard to be exported.Only for dashboards0 - For Each Report in New Page 1 - For Layout as in Dashboard
CSV Specific Attributes
Key
Description
delimiter
Integer The delimiter character used for separating the fields in a row in the CSV.0 - COMMA 1 - TAB 2 - SEMICOLON 3 - SPACE
recordDelimiter
Integer The record delimiter (newline character) to use.
quoted
Integer The quote character to use for quoting the values.
includeHeader
Boolean To include the column names in the first row of the CSV exported. Default value - true.
JSON Specific Attributes
Key
Description
keyValueFormat
Boolean To return JSON data as ColumnName - Value pair. Default value - true.
PDF Specific Attributes
Key
Description
paperSize
Integer The size of the paper.0 - LETTER 1 - LEGAL 2 - TABLOID 3 - A3 4 - A4 5 - AUTO
paperStyle
String To controls the orientation. Portrait/Landscape
showTitle
Integer To controls the title positioning.0 - AT TOP 1 - AT BOTTOM 2 - NONE
showDesc
Integer To controls the description positioning.0 - AT TOP 1 - AT BOTTOM 2 - NONE
exportLanguage
Integer PDF will be rendered using the specified language.0 - ENGLISH 1 - CHINESE 2 - JAPANESE 3 - EUROPEAN 4 - KOREAN Default value - 0 (ENGLISH).
zoomfactor
Integer To control the zoom factor for the PDF. 0 to 100 Default value - 100.
Margin Settings:
topMargin bottomMargin leftMargin rightMargin
Float The margin in inches for that edge. Can be decimal between 0 to 1 (like 0.5).
Header/Footer Settings:
leftHeader rightHeader centerHeader leftFooter rightFooter centerFooter
Integer The header or footer value that needs to be generated for each page at that particular position.0 - Leave it blank 1 - Include Title 2 - Current Date/Time 3 - Include Page number in the format “Page #” 4 - Include page number in the format “Page # Of #” 5 - CUSTOM - Include custom text in footer
Custom Header/Footer value
leftHeaderText rightHeaderText centerHeaderText leftFooterText rightFooterText centerFooterText
String If any of the header/footer setting is 5 (.ie, CUSTOM) then the corresponding custom value/text should be passed.
HTML Specific Attributes
Key
Description
includeTitle
Integer To contol the title positioning. Default value - 0.0 - AT TOP 1 - AT BOTTOM 2 - NONE
includeDesc
Integer To contol the description positioning. Default value - 0.0 - AT TOP 1 - AT BOTTOM 2 - NONE
IMAGE Specific Attributes
Key
Description
width
Integer The width of the image. Default value - 500.
height
Integer The height of the image. Default value - 400.
title
Boolean To include the view name in the exported view. Default value - true.
description
Boolean To include the view description in the exported view. Default value - true.
legend
Boolean Controls whether the legend is to be included in the image generated. Default value - true.
imageFormat
String The format of the exported image.png/jpg Default value - png.
Possible Error Codes
7103 , 7138 , 8002 , 8046 , 8119 , 8504
Export Data (Asynchronous)
Export a large set of data from tables/reports in asynchronous manner.
Work flow of Bulk Export API is as follows:
Using Create Export Job API, an export job will be created, a JOBID will be returned in the response, which is the reference for the export job. Using Get Export Job Details API, status of the export job can be checked periodically. Upon job completion the system notifies the user in the callback URL (if provided). Using Download Exported Data API, the exported data can be downloaded.
Limitations :
The exported data will be available for download only for a period of one hour from the time of job completion.
Simultaneously 5 export jobs only allowed for an organization.
Create Export Job
Create an export job for exporting data from a single view (or) use SQL queries to export data by joining multiple tables.
Using View ID
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void InitiateBulkExport ( IAnalyticsClient ac )
{
string responseFormat = "csv" ;
IBulkAPI data = ac . GetBulkInstance ( orgId , workspaceId );
long jobId = data . InitiateBulkExport ( viewId , responseFormat , null );
Console . WriteLine ( jobId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . InitiateBulkExport ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35130000001055707"
)
func InitiateBulkExport ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
responseformat := "pdf"
bulk := ZAnalytics . GetBulkInstance ( & ac , orgId , workspaceId )
result , err := bulk . InitiateBulkExport ( viewId , responseformat , config )
if ( err != nil ){
fmt . Println ( err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
InitiateBulkExport ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . initiateBulkExport ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void initiateBulkExport ( AnalyticsClient ac ) throws Exception {
String responseFormat = "csv" ;
BulkAPI bulk = ac . getBulkInstance ( orgId , workspaceId );
long jobId = bulk . initiateBulkExport ( viewId , responseFormat , null );
System . out . println ( jobId );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function initiateBulkExport () {
$response_format = "csv" ;
$bulk = $this -> ac -> getBulkInstance ( $this -> org_id , $this -> workspace_id );
$response = $bulk -> initiateBulkExport ( $this -> view_id , $response_format );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> initiateBulkExport ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def initiate_bulk_export ( self , ac ):
response_format = "csv"
bulk = ac . get_bulk_instance ( Config . ORGID , Config . WORKSPACEID )
result = bulk . initiate_bulk_export ( Config . VIEWID , response_format )
print ( result )
try :
obj = sample ()
obj . initiate_bulk_export ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var responseFormat = 'csv' ;
var bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . initiateBulkExport ( viewId , responseFormat ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
config = Map ();
config.put ( "responseFormat" , "csv" );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/" + workspaceId + "/views/" + viewId + "/data"
type : GET
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/<workspace-id>/views/<view-id>/data?CONFIG=<encoded_json_value>
-X 'GET'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"responseFormat": "csv"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create bulk export job" ,
"data" : {
"jobId" : "35130000001381001"
}
}
Create an export job to initiate data export for the mentioned view.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/bulk/workspaces/<workspace-id>/views/<view-id>/data
oauthscope: ZohoAnalytics.data.read
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
responseFormat*
String The format of the data to be exported.
criteria
String If criteria is sent, then the rows matching the criteria alone are exported.Sample: {"criteria":"\"SalesTable\".\"Region\"='East'"} Refer this link for more details about how to construct a criteria.
selectedColumns
JSONArray Controls the columns that need to be exported.Sample: ["column1","column2"]
showHiddenCols
Boolean Controls whether the columns that have been hidden in the table have to be exported. Default value - false.
showPersonalCols
Boolean Controls whether the columns that have been marked as personal data in the table have to be exported. Default value - false.
generateTOC
Boolean To generate Table Of Contents.Only for dashboards Default value - false.
dashboardLayout
Integer Layout type of the dashboard to be exported.Only for dashboards0 - For Each Report in New Page 1 - For Layout as in Dashboard
callbackUrl
String A valid URL, that should allow HTTP Post method. The Bulk Export Job's details is posted to this URL on successful completion of job or on failure of job.
CSV Specific Attributes
Key
Description
delimiter
Integer The delimiter character used for separating the fields in a row in the CSV.0 - COMMA 1 - TAB 2 - SEMICOLON 3 - SPACE
recordDelimiter
Integer The record delimiter (newline character) to use.
quoted
Integer The quote character to use for quoting the values.
includeHeader
Boolean To include the column names in the first row of the CSV exported. Default value - true.
JSON Specific Attributes
Key
Description
keyValueFormat
Boolean To return JSON data as ColumnName - Value pair. Default value - true.
PDF Specific Attributes
Key
Description
paperSize
Integer The size of the paper.0 - LETTER 1 - LEGAL 2 - TABLOID 3 - A3 4 - A4 5 - AUTO
paperStyle
String To controls the orientation. Portrait/Landscape
showTitle
Integer To controls the title positioning.0 - AT TOP 1 - AT BOTTOM 2 - NONE
showDesc
Integer To controls the description positioning.0 - AT TOP 1 - AT BOTTOM 2 - NONE
exportLanguage
Integer PDF will be rendered using the specified language.0 - ENGLISH 1 - CHINESE 2 - JAPANESE 3 - EUROPEAN 4 - KOREAN Default value - 0 (ENGLISH).
zoomfactor
Integer To control the zoom factor for the PDF. 0 to 100 Default value - 100.
Margin Settings:
topMargin bottomMargin leftMargin rightMargin
Float The margin in inches for that edge. Can be decimal between 0 to 1 (like 0.5).
Header/Footer Settings:
leftHeader rightHeader centerHeader leftFooter rightFooter centerFooter
Integer The header or footer value that needs to be generated for each page at that particular position.0 - Leave it blank 1 - Include Title 2 - Current Date/Time 3 - Include Page number in the format “Page #” 4 - Include page number in the format “Page # Of #” 5 - CUSTOM - Include custom text in footer
Custom Header/Footer value
leftHeaderText rightHeaderText centerHeaderText leftFooterText rightFooterText centerFooterText
String If any of the header/footer setting is 5 (.ie, CUSTOM) then the corresponding custom value/text should be passed.
HTML Specific Attributes
Key
Description
includeTitle
Integer To contol the title positioning. Default value - 0.0 - AT TOP 1 - AT BOTTOM 2 - NONE
includeDesc
Integer To contol the description positioning. Default value - 0.0 - AT TOP 1 - AT BOTTOM 2 - NONE
IMAGE Specific Attributes
Key
Description
width
Integer The width of the image. Default value - 500.
height
Integer The height of the image. Default value - 400.
title
Boolean To include the view name in the exported view. Default value - true.
description
Boolean To include the view description in the exported view. Default value - true.
legend
Boolean Controls whether the legend is to be included in the image generated. Default value - true.
imageFormat
String The format of the exported image.png/jpg Default value - png.
Possible Error Codes
7103 , 7138 , 8002 , 8046 , 8119 , 8504
Using SQL Query
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void InitiateBulkExportUsingSQL ( IAnalyticsClient ac )
{
string responseFormat = "csv" ;
String sqlQuery = "select * from Sales" ;
IBulkAPI data = ac . GetBulkInstance ( orgId , workspaceId );
long jobId = data . InitiateBulkExportUsingSQL ( sqlQuery , responseFormat , null );
Console . WriteLine ( jobId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . InitiateBulkExportUsingSQL ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func InitiateBulkExportUsingSQL ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
sqlquery := "select * from Sales"
responseformat := "csv"
bulk := ZAnalytics . GetBulkInstance ( & ac , orgId , workspaceId )
result , err := bulk . InitiateBulkExportUsingSQL ( sqlquery , responseformat , config )
if ( err != nil ){
fmt . Println ( err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
InitiateBulkExportUsingSQL ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . initiateBulkExportUsingSQL ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void initiateBulkExportUsingSQL ( AnalyticsClient ac ) throws Exception {
String sqlQuery = "select * from Sales" ;
String responseFormat = "csv" ;
BulkAPI bulk = ac . getBulkInstance ( orgId , workspaceId );
long jobId = bulk . initiateBulkExportUsingSQL ( sqlQuery , responseFormat , null );
System . out . println ( jobId );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function initiateBulkExportUsingSQL () {
$sql_query = "select * from Sales" ;
$response_format = "csv" ;
$bulk = $this -> ac -> getBulkInstance ( $this -> org_id , $this -> workspace_id );
$response = $bulk -> initiateBulkExportUsingSQL ( $sql_query , $response_format );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> initiateBulkExportUsingSQL ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def initiate_bulk_export_using_sql ( self , ac ):
response_format = "CSV"
sql_query = "select * from Sales where Region='East'"
bulk = ac . get_bulk_instance ( Config . ORGID , Config . WORKSPACEID )
result = bulk . initiate_bulk_export_using_sql ( sql_query , response_format )
print ( result )
try :
obj = sample ()
obj . initiate_bulk_export_using_sql ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var responseFormat = 'csv' ;
var sqlQuery = 'select * from Sales' ;
var bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . initiateBulkExportUsingSQL ( sqlQuery , responseFormat ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
config = Map ();
config.put ( "responseFormat" , "csv" );
config.put ( "sqlQuery" , "select * from Sales" );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/" + workspaceId + "/data"
type : GET
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/<workspace-id>/data?CONFIG=<encoded_json_value>
-X 'GET'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"responseFormat": "csv",
"sqlQuery": "select * from Sales"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create bulk export job" ,
"data" : {
"jobId" : "35130000001391001"
}
}
Create an export job using SQL select statement to initiate data export.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/bulk/workspaces/<workspace-id>/data
oauthscope: ZohoAnalytics.data.read
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
sqlQuery*
String SQL SELECT Query. Using SQL Select statements data can be exported from a single Table/Query Table or joining one or more tables.Check here for more details.
responseFormat*
String The format of the data to be exported.
selectedColumns
JSONArray Controls the columns that need to be exported.Sample: ["column1","column2"]
showHiddenCols
Boolean Controls whether the columns that have been hidden in the table have to be exported. Default value - false.
showPersonalCols
Boolean Controls whether the columns that have been marked as personal data in the table have to be exported. Default value - false.
callbackUrl
String A valid URL, that should allow HTTP Post method. The Bulk Export Job's details is posted to this URL on successful completion of job or on failure of job.
CSV Specific Attributes
Key
Description
delimiter
Integer The delimiter character used for separating the fields in a row in the CSV.0 - COMMA 1 - TAB 2 - SEMICOLON 3 - SPACE
recordDelimiter
Integer The record delimiter (newline character) to use.
quoted
Integer The quote character to use for quoting the values.
includeHeader
Boolean To include the column names in the first row of the CSV exported. Default value - true.
JSON Specific Attributes
Key
Description
keyValueFormat
Boolean To return JSON data as ColumnName - Value pair. Default value - true.
PDF Specific Attributes
Key
Description
paperSize
Integer The size of the paper.0 - LETTER 1 - LEGAL 2 - TABLOID 3 - A3 4 - A4 5 - AUTO
paperStyle
String To controls the orientation. Portrait/Landscape
showTitle
Integer To controls the title positioning.0 - AT TOP 1 - AT BOTTOM 2 - NONE
showDesc
Integer To controls the description positioning.0 - AT TOP 1 - AT BOTTOM 2 - NONE
exportLanguage
Integer PDF will be rendered using the specified language.0 - ENGLISH 1 - CHINESE 2 - JAPANESE 3 - EUROPEAN 4 - KOREAN Default value - 0 (ENGLISH).
zoomfactor
Integer To control the zoom factor for the PDF. Between 0 to 100 Default value - 100.
Margin Settings:
topMargin bottomMargin leftMargin rightMargin
Decimal values between 0 to 1
The margin in inches for that edge. Can be decimal between 0 to 1 (like 0.5).
Header/Footer Settings:
leftHeader rightHeader centerHeader leftFooter rightFooter centerFooter
Integer The header or footer value that needs to be generated for each page at that particular position.0 - Leave it blank 1 - Include Title 2 - Current Date/Time 3 - Include Page number in the format “Page #” 4 - Include page number in the format “Page # Of #” 5 - CUSTOM - Include custom text in footer
Custom Header/Footer value
leftHeaderText rightHeaderText centerHeaderText leftFooterText rightFooterText centerFooterText
String If any of the header/footer setting is 5 (.ie, CUSTOM) then the corresponding custom value/text should be passed.
HTML Specific Attributes
Key
Description
includeTitle
Integer To contol the title positioning. Default value - 0.0 - AT TOP 1 - AT BOTTOM 2 - NONE
includeDesc
Integer To contol the description positioning. Default value - 0.0 - AT TOP 1 - AT BOTTOM 2 - NONE
Possible Error Codes
7103 , 7403 , 8002 , 8046 , 8119 , 8504
Get Export Job Details
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetExportJobDetails ( IAnalyticsClient ac )
{
long jobId = 35130000001351004 ;
IBulkAPI data = ac . GetBulkInstance ( orgId , workspaceId );
Dictionary < string , object > jobInfo = data . GetExportJobDetails ( jobId );
Console . WriteLine ( jobInfo );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetExportJobDetails ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetExportJobDetails ( ac ZAnalytics . Client ) {
jobid := "35130000001412003"
bulk := ZAnalytics . GetBulkInstance ( & ac , orgId , workspaceId )
result , err := bulk . GetExportJobDetails ( jobid )
if ( err != nil ){
fmt . Println ( err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetExportJobDetails ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getExportJobDetails ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getExportJobDetails ( AnalyticsClient ac ) throws Exception {
long jobId = 35130000001343084 l ;
BulkAPI data = ac . getBulkInstance ( orgId , workspaceId );
JSONObject jobInfo = data . getExportJobDetails ( jobId );
System . out . println ( jobInfo );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getExportJobDetails () {
$job_id = "35130000001345002" ;
$bulk = $this -> ac -> getBulkInstance ( $this -> org_id , $this -> workspace_id );
$response = $bulk -> getExportJobDetails ( $job_id );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getExportJobDetails ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_export_job_details ( self , ac ):
job_id = "35130000001334001"
bulk = ac . get_bulk_instance ( Config . ORGID , Config . WORKSPACEID )
result = bulk . get_export_job_details ( job_id )
print ( result )
try :
obj = sample ()
obj . get_export_job_details ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var jobId = '' ;
var bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . getExportJobDetails ( jobId ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
jobId = "5888000000222090" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/" + workspaceId + "/exportjobs/" + jobId
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/<workspace-id>/exportjobs/<job-id>
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Fetch export job info" ,
"data" : {
"jobId" : "35130000001391001" ,
"jobCode" : "1004" ,
"jobStatus" : "JOB COMPLETED" ,
"downloadUrl" : "https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/35130000001242001/exportjobs/35130000001391001/data" ,
"expiryTime" : "1623765872891"
}
}
Returns details of the specified export job.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/bulk/workspaces/<workspace-id>/exportjobs/<job-id>
oauthscope: ZohoAnalytics.data.read
Possible Error Codes
7103 , 8120 , 8124
Download Exported Data
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void ExportBulkData ( IAnalyticsClient ac )
{
long jobId = 35130000001348005 ;
string filePath = "D:\\Sample.csv" ;
IBulkAPI data = ac . GetBulkInstance ( orgId , workspaceId );
data . ExportBulkData ( jobId , filePath );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . ExportBulkData ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func ExportBulkData ( ac ZAnalytics . Client ) {
jobid := "35130000001412003"
filepath := "/home/local/admin/Files/Sales.pdf"
bulk := ZAnalytics . GetBulkInstance ( & ac , orgId , workspaceId )
exception := bulk . ExportBulkData ( jobid , filepath )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
ExportBulkData ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . exportBulkData ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void exportBulkData ( AnalyticsClient ac ) throws Exception {
long jobId = 35130000001342175 l ;
String filePath = "/home/local/admin/Files/Sales.csv" ;
BulkAPI bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . exportBulkData ( jobId , filePath );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function exportBulkData () {
$job_id = "35130000001345002" ;
$file_path = "/home/local/admin/Files/Sales.csv" ;
$bulk = $this -> ac -> getBulkInstance ( $this -> org_id , $this -> workspace_id );
$bulk -> exportBulkData ( $job_id , $file_path );
}
}
$test_obj = new Test ();
try {
$test_obj -> exportBulkData ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def export_bulk_data ( self , ac ):
job_id = "35130000001334001"
file_path = "/home/local/admin/Files/Sales.csv"
bulk = ac . get_bulk_instance ( Config . ORGID , Config . WORKSPACEID )
bulk . export_bulk_data ( job_id , file_path )
try :
obj = sample ()
obj . export_bulk_data ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var jobId = '' ;
var filePath = '/home/local/admin/Files/Sales.csv' ;
var bulk = ac . getBulkInstance ( orgId , workspaceId );
bulk . exportBulkData ( jobId , filePath ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
jobId = "5888000000222090" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/" + workspaceId + "/exportjobs/" + jobId + "/data"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/bulk/workspaces/<workspace-id>/exportjobs/<job-id>/data
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:text/csv;charset=UTF-8
Date,Region,Product,Customer Name,Sales
"15 June, 2021" ,East,Cereals,Vincent Herbert,682.39
"15 June, 2021" ,West,Clocks,John Britto,$272.34
"15 June, 2021" ,Central,Art Supplies,Susan Juliet,$45.31
Download data for the bulk export job.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/bulk/workspaces/<workspace-id>/exportjobs/<job-id>/data
oauthscope: ZohoAnalytics.data.read
Possible Error Codes
7103 , 8120 , 8121 , 8122 , 8124
Error codes in Bulk API
Sample Error:
HTTP/1.1 400 Bad Request
Content-Type:application/json;charset=UTF-8
{
"status" : "failure" ,
"summary" : "META_DBOBJECT_NAME_DUPLICATED" ,
"data" : {
"errorCode" : 7111,
"errorMessage" : "A Table with the name Sales already exists in this workspace. Please provide an alternate name."
}
}
This section lists all possible error codes that could be sent from the Zoho Analytics server on failure of Data APIs. You can use this for appropriate error handling.
Error Codes
Error-Code
Reason
Solution
7103
The workspace id mentioned in the API does not exist.
Provide the valid workspace id.
7111
A table with the same name already exist.
Provide an alternative name.
7138
The view id mentioned in the API URL does not exist.
Check the view id in the request URL and provide a valid view id.
7232
Import Aborted.
Check the error message returned.
7235
Not even a single column name provided in source file matches with the column data in table.
Check whether the column name in source data matches with column names present in analytics table.
NOTE:Also check whether the config fileType is provided with proper value.
7248
The file content is not \"multipart/form-data\" format.
Check whether the file is passed as multipart-form data.
7249
The file cannot be imported.
Verify whether the file content is same as the "fileType" provided.
7403
Parsing of SQL query failed.
Check the SQL syntax provided is valid.
7507
Value entered in the mentioned column does not follow the specified data-type.
Check the value of that column and provide value in the specified data-type.
7511
Mentioned Column is a mandatory column.
Should specify the value for that mandatory column.
8002
Specified criteria is invalid.
Provide valid criteria.
8004
The column mentioned in the criteria is not present in the table.
Check the column name and provide valid name.
8016
You need to have at-least one column for INSERT or UPDATE action.
You should provide at-least one column with value.
8046
Not even one column in the selected columns list is valid.
Check whether the column name provided is present in the table.
8119
Invalid value provided for the attribute.
Check the value for the attribute provided is valid.
8120
Export job not found.
Check the export job id provided is valid and not expired.
8121
Export job not initiated.
Check the export job is completed before downloadin the data.
8122
Export job not completed.
Check the export job is completed before downloadin the data.
8124
Export job access denied.
Only the user created the job can access the job.
8137
Import job not found.
Check the import job id provided is valid and not expired.
8138
Import job access denied.
Only the user created the job can access the job.
8504
The required parameter is not proper or has not been sent.
Send the parameter with valid data.
8506
The mentioned parameter has been sent more than the required count.
Check and remove that extra parameter mentioned in the response.
8513
The file size is more than the supported size.
File size should be less than the mentioned size.
8516
Invalid value passed in the mentioned parameter.
Provide the valid data to the mentioned parameter.
Modeling API
Modeling APIs are used to add, delete and rename Zoho Analytics workspaces, views, columns, and folders. It also offers APIs to copy workspaces, reports, and formulas from one workspace to another workspace in the same account or across different accounts.
Create Workspace
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
public void CreateWorkspace ( IAnalyticsClient ac )
{
string workspaceName = "C# Lib" ;
IOrgAPI org = ac . GetOrgInstance ( orgId );
long workspaceId = org . CreateWorkspace ( workspaceName , null );
Console . WriteLine ( workspaceId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CreateWorkspace ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func CreateWorkspace ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
workspacename := "Go Lib"
org := ZAnalytics . GetOrgInstance ( & ac , orgId )
result , exception := org . CreateWorkspace ( workspacename , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CreateWorkspace ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . createWorkspace ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void createWorkspace ( AnalyticsClient ac ) throws Exception {
String workspaceName = "JAVA Lib" ;
OrgAPI org = ac . getOrgInstance ( orgId );
long result = org . createWorkspace ( workspaceName , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function createWorkspace () {
$workspace_name = "PHP Lib workspace - 1" ;
$org = $this -> ac -> getOrgInstance ( $this -> org_id );
$response = $org -> createWorkspace ( $workspace_name );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> createWorkspace ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def create_workspace ( self , ac ):
workspace_name = "Python Lib"
org = ac . get_org_instance ( Config . ORGID )
result = org . create_workspace ( workspace_name )
print ( result )
try :
obj = sample ()
obj . create_workspace ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var workspaceName = '' ;
var org = ac . getOrgInstance ( orgId );
org . createWorkspace ( workspaceName , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
config = Map ();
workspaceName = "Workspace -1" ;
config.put ( "workspaceName" , workspaceName );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"workspaceName": "<workspace-name>"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create workspace" ,
"data" : {
"workspaceId" : "1767024000003145002"
}
}
Create a blank workspace in the specified organization.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
workspaceName*
String The name of the workspace.
workspaceDesc
String The description of the workspace.
Possible Error Codes
7101 , 8504 , 8506 , 8516
Copy Workspace
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void CopyWorkspace ( IAnalyticsClient ac )
{
string newWorkspaceName = "C# Lib Copy" ;
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
long newWorkspaceId = ws . Copy ( newWorkspaceName , null , null );
Console . WriteLine ( newWorkspaceId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CopyWorkspace ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func CopyWorkspace ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
newworkspacename := "Go Lib Copied db"
destorgid := ""
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . Copy ( newworkspacename , config , destorgid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CopyWorkspace ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . copyWorkspace ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void copyWorkspace ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
String workspaceName = "JAVA Lib" ;
long result = workspace . copy ( workspaceName , null , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function copyWorkspace () {
$new_workspace_name = "PHP Lib copy workspace" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> copy ( $new_workspace_name );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> copyWorkspace ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def copy_workspace ( self , ac ):
new_workspace_name = "Copied Python Lib"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . copy ( new_workspace_name )
print ( result )
try :
obj = sample ()
obj . copy_workspace ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var workspaceName = '' ;
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . copy ( workspaceName , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
config = Map ();
newWorkspaceName = "Workspace - 2" ;
config.put ( "newWorkspaceName" , newWorkspaceName );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <source-org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"newWorkspaceName": "<workspace-name>"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Copy workspace" ,
"data" : {
"workspaceId" : "1767024000003145006"
}
}
Copy the specified workspace from one organization to another or within the organization.
Note: For ZANALYTICS-ORGID header, provide the source organization id as the value.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
newWorkspaceName*
String The name of the new workspace.
newWorkspaceDesc
String The description of the new workspace.
workspaceKey
String source workspace secret key The secret key used for allowing the user to copy the source workspace.
copyWithData
Boolean To copy the workspace with table data.
copyWithImportSource
Boolean To copy the workspace with import sources.
Name
Value
Description
ZANALYTICS-DEST-ORGID
<destination-org-id>
Id of the organization where the workspace have to be copied.
Possible Error Codes
7101 , 7103 , 7138 , 8024 , 8504 , 8506 , 8516 , 15007
Rename Workspace
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void RenameWorkspace ( IAnalyticsClient ac )
{
string newWorkspaceName = "Renamed C# Lib" ;
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . Rename ( newWorkspaceName , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RenameWorkspace ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func RenameWorkspace ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
workspacename := "Renamed Go Lib"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . Rename ( workspacename , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RenameWorkspace ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . renameWorkspace ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void renameWorkspace ( AnalyticsClient ac ) throws Exception {
String workspaceName = "JAVA Lib" ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . rename ( workspaceName , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function renameWorkspace () {
$workspace_name = "Renamed PHP Lib workspace" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> rename ( $workspace_name );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> renameWorkspace ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def rename_workspace ( self , ac ):
new_workspace_name = "Renamed Python Lib"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . rename ( new_workspace_name )
print ( "success" )
try :
obj = sample ()
obj . rename_workspace ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var workspaceName = '' ;
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . rename ( workspaceName , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
workspaceName = "New Workspace" ;
config = Map ();
config.put ( "workspaceName" , workspaceName );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"workspaceName": "<workspace-name>"
}
Sample Response:
HTTP/1.1 204 No Content
Rename a specified workspace in the organization.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>
oauthscope: ZohoAnalytics.modeling.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
workspaceName*
String The new name of the workspace.
workspaceDesc
String The new description of the workspace.
Possible Error Codes
7103 , 7138 , 7165 , 8504 , 8506 , 8516
Delete Workspace
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void DeleteWorkspace ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . Delete ();
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . DeleteWorkspace ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func DeleteWorkspace ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . Delete ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
DeleteWorkspace ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . deleteWorkspace ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void deleteWorkspace ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . delete ();
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function deleteWorkspace () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> delete ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> deleteWorkspace ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def delete_workspace ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . delete ()
print ( "success" )
try :
obj = sample ()
obj . delete_workspace ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . delete (). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Delete a specified workspace in the organization.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>
oauthscope: ZohoAnalytics.modeling.delete
Possible Error Codes
7103 , 7138 , 7165 , 8504 , 8506 , 8516
Create Table
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void CreateTable ( IAnalyticsClient ac )
{
Dictionary < string , object > tableDesign = new Dictionary < string , object >();
tableDesign . Add ( "TABLENAME" , "Test C#" );
tableDesign . Add ( "TABLEDESCRIPTION" , "Test C# Desc" );
List < Dictionary < string , object >> columns = new List < Dictionary < string , object >>();
Dictionary < string , object > column1 = new Dictionary < string , object >();
column1 . Add ( "COLUMNNAME" , "Col1" );
column1 . Add ( "DATATYPE" , "PLAIN" );
Dictionary < string , object > column2 = new Dictionary < string , object >();
column2 . Add ( "COLUMNNAME" , "Col2" );
column2 . Add ( "DATATYPE" , "NUMBER" );
columns . Add ( column1 );
columns . Add ( column2 );
tableDesign . Add ( "COLUMNS" , columns );
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
long viewId = ws . CreateTable ( tableDesign );
Console . WriteLine ( viewId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CreateTable ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func CreateTable ( ac ZAnalytics . Client ) {
tableDesign := map [ string ] interface {}{}
tableDesign [ "TABLENAME" ] = "Table Name"
tableDesign [ "TABLEDESCRIPTION" ] = "Description"
type column map [ string ] interface {}
column1 := column { "COLUMNNAME" : "Col1" , "DATATYPE" : "PLAIN" }
column2 := column { "COLUMNNAME" : "Col2" , "DATATYPE" : "NUMBER" }
var columns [] column
columns = append ( columns , column1 , column2 )
tableDesign [ "COLUMNS" ] = columns
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . CreateTable ( tableDesign )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CreateTable ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . createTable ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void createTable ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONObject tableDesign = new JSONObject ();
tableDesign . put ( "TABLENAME" , "SalesTable" );
tableDesign . put ( "TABLEDESCRIPTION" , "Description" );
JSONObject column1 = new JSONObject ();
column1 . put ( "COLUMNNAME" , "Column 1" );
column1 . put ( "DATATYPE" , "PLAIN" );
JSONObject column2 = new JSONObject ();
column2 . put ( "COLUMNNAME" , "Column 2" );
column2 . put ( "DATATYPE" , "NUMBER" );
JSONArray columns = new JSONArray ();
columns . put ( column1 );
columns . put ( column2 );
tableDesign . put ( "COLUMNS" , columns );
long result = workspace . createTable ( tableDesign );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function createTable () {
$table_design = array ();
$table_design [ "TABLENAME" ] = "Sample" ;
$table_design [ "TABLEDESCRIPTION" ] = "Description" ;
$column1 = array ();
$column1 [ "COLUMNNAME" ] = "Col1" ;
$column1 [ "DATATYPE" ] = "PLAIN" ;
$column2 = array ();
$column2 [ "COLUMNNAME" ] = "Col2" ;
$column2 [ "DATATYPE" ] = "NUMBER" ;
$columns = array ( $column1 , $column2 );
$table_design [ "COLUMNS" ] = $columns ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> createTable ( $table_design );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> createTable ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def create_table ( self , ac ):
columns_arr = []
column1 = {}
column1 [ "COLUMNNAME" ] = "Col1"
column1 [ "DATATYPE" ] = "PLAIN"
column2 = {}
column2 [ "COLUMNNAME" ] = "Col2"
column2 [ "DATATYPE" ] = "NUMBER"
columns_arr . append ( column1 )
columns_arr . append ( column2 )
table_design = {}
table_design [ "TABLENAME" ] = "Created Table"
table_design [ "COLUMNS" ] = columns_arr
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . create_table ( table_design )
print ( result )
try :
obj = sample ()
obj . create_table ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var columnsArray = [];
var column1 = {};
column1 [ "COLUMNNAME" ] = "Col1" ;
column1 [ "DATATYPE" ] = "PLAIN" ;
columnsArray . push ( column1 );
var column2 = {};
column2 [ "COLUMNNAME" ] = "Col2" ;
column2 [ "DATATYPE" ] = "NUMBER" ;
columnsArray . push ( column2 );
var tableDesign = {};
tableDesign [ "TABLENAME" ] = "Created" ;
tableDesign [ "COLUMNS" ] = columnsArray ;
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . createTable ( tableDesign ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
tableDesign = Map ();
tableDesign.put ( "TABLENAME" , "Test Table" );
tableDesign.put ( "TABLEDESCRIPTION" , "Table Description" );
column1 = Map ();
column1.put ( "COLUMNNAME" , "Col1" );
column1.put ( "DATATYPE" , "PLAIN" );
column2 = Map ();
column2.put ( "COLUMNNAME" , "Col2" );
column2.put ( "DATATYPE" , "NUMBER" );
columns = {};
columns.add ( column1 );
columns.add ( column2 );
tableDesign.put ( "COLUMNS" , columns );
design = Map ();
design.put ( "tableDesign" , tableDesign );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , design.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/tables"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/tables?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"tableDesign": {
"TABLENAME": "Sales",
"TABLEDESCRIPTION": "Test",
"COLUMNS": [{
"COLUMNNAME": "Column1",
"DATATYPE": "PLAIN"
}, {
"COLUMNNAME": "Column2",
"DATATYPE": "NUMBER"
}]
}
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create table" ,
"data" : {
"viewId" : "1767024000003145011"
}
}
Create a table in the specified workspace.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/tables
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
tableDesign*
JSONObject <Table Structure>
Table Structure
Key
Description
TABLENAME*
String The name of the table.
TABLEDESCRIPTION
String The description of the table.
FOLDERNAME
String The name of the folder where the table have to be created.
COLUMNS*
JSONArray <Column Structure>
Column Structure
Key
Description
COLUMNNAME*
String The name of the column.
DATATYPE*
String The data type of the column. Supported data types:PLAIN MULTI_LINE EMAIL NUMBER POSITIVE_NUMBER DECIMAL_NUMBER CURRENCY PERCENT DATE BOOLEAN URL AUTO_NUMBER GEO
MANDATORY
Boolean Controls whether the column should contain a mandatory non-empty value. Default value - false.
DESCRIPTION
String The description of the column.
DEFAULT
String Default value for the column Fills the provided value when a cell in the column is empty.
GEOROLE
Integer To specify the geo location type. This attribute is mandatory for GEO DATATYPE.
0 - Continent 1 - Country 2 - State/Province 3 - County/Distict 4 - City 5 - Zip Code 6 - Latitude 7 - Longitude 8 - Airport
Possible Error Codes
7103 , 7111 , 7138 , 8504 , 8506 , 8516 , 8534
Saveas View
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void SaveAsView ( IAnalyticsClient ac )
{
string newViewName = "Saveas table" ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
long destViewId = view . SaveAs ( newViewName , null );
Console . WriteLine ( destViewId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . SaveAsView ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func SaveAsView ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
newviewname := "New view name"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , exception := view . SaveAs ( newviewname , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
SaveAsView ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . saveAsView ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void saveAsView ( AnalyticsClient ac ) throws Exception {
String newViewName = "" ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
long result = view . saveAs ( newViewName , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function saveAsView () {
$new_view_name = "New View" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> saveAs ( $new_view_name );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> saveAsView ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def save_as_view ( self , ac ):
new_view_name = "Saveas Python Lib view 2"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . save_as ( new_view_name )
print ( result )
try :
obj = sample ()
obj . save_as_view ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var newViewName = '' ;
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . saveAs ( newViewName , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
config = Map ();
config.put ( "viewName" , "New view name" );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/saveas"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/saveas?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"viewName": "<view-name>"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Saveas view" ,
"data" : {
"viewId" : "1767024000004723001"
}
}
Copy a specified view within the workspace.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/saveas
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
viewName*
String The name of the new view.
viewDesc
String The description of the new view.
copyWithData
Boolean To copy table with data.
copyWithLookup
Boolean To copy table with lookup details.
folderId
Long
The folder id where the created view to be placed.
Possible Error Codes
7103 , 7105 , 7111 , 7144 , 8504 , 8506 , 8516 , 15018
Rename View
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void RenameView ( IAnalyticsClient ac )
{
string newViewName = "Renamed table" ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . Rename ( newViewName , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RenameView ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func RenameView ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
newviewname := "New view name"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . Rename ( newviewname , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RenameView ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . renameView ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void renameView ( AnalyticsClient ac ) throws Exception {
String viewName = "" ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . rename ( viewName , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function renameView () {
$view_name = "Renamed view" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> rename ( $view_name );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> renameView ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def rename_view ( self , ac ):
new_view_name = "Renamed Python Lib view"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . rename ( new_view_name )
print ( "success" )
try :
obj = sample ()
obj . rename_view ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var newViewName = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . rename ( newViewName , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
config = Map ();
config.put ( "viewName" , "New view name" );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"viewName": "<view-name>"
}
Sample Response:
HTTP/1.1 204 No Content
Rename a specified view in the workspace.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>
oauthscope: ZohoAnalytics.modeling.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
viewName*
String The new name of the view.
viewDesc
String The new description of the view.
Possible Error Codes
7103 , 7105 , 7111 , 7138 , 8504 , 8506 , 8516
Delete View
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void DeleteView ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . Delete ( null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . DeleteView ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func DeleteView ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . Delete ( config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
DeleteView ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . deleteView ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void deleteView ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . delete ( null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function deleteView () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> delete ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> deleteView ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def delete_view ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . delete ()
print ( "success" )
try :
obj = sample ()
obj . delete_view ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . delete ( config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Delete a specified view in the workspace.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>
oauthscope: ZohoAnalytics.modeling.delete
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
deleteDependentViews
Boolean To delete dependent views while deleting a table/querytable(table/querytable which has dependent views).
Possible Error Codes
7103 , 7138 , 7277 , 8504 , 8506 , 8516
Create Folder
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void CreateFolder ( IAnalyticsClient ac )
{
string folderName = "Test folder" ;
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
long folderId = ws . CreateFolder ( folderName , null );
Console . WriteLine ( folderId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CreateFolder ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func CreateFolder ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
foldername := "Go Lib"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . CreateFolder ( foldername , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CreateFolder ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . createFolder ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void createFolder ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
String folderName = "" ;
long result = workspace . createFolder ( folderName , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function createFolder () {
$folder_name = "API Lib workspace" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> createFolder ( $folder_name );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> createFolder ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def create_folder ( self , ac ):
folder_name = "New Folder 1"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . create_folder ( folder_name )
print ( result )
try :
obj = sample ()
obj . create_folder ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var folderName = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . createFolder ( folderName , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
folderName = "New Folder" ;
config = Map ();
config.put ( "folderName" , folderName );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/folders"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/folders?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"folderName": "<folder-name>"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create folder" ,
"data" : {
"folderId" : "1767024000003145066"
}
}
Create a folder in the specified workspace.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/folders
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
folderName*
String The name of the folder.
folderDesc
String The description of the folder.
parentFolderId
Long
Id of the parent folder. Newly created folder will be placed under this folder.
Possible Error Codes
7103 , 7138 , 7277 , 8504 , 8506 , 8516
Rename Folder
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void RenameFolder ( IAnalyticsClient ac )
{
long folderId = 1148746000002559043 ;
string folderName = "Renamed folder" ;
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . RenameFolder ( folderId , folderName , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RenameFolder ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func RenameFolder ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
folderid := "35130000001400167"
foldername := "Renamed Go Folder"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . RenameFolder ( folderid , foldername , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RenameFolder ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . renameFolder ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void renameFolder ( AnalyticsClient ac ) throws Exception {
long folderId = 35130000001400167 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
String folderName = "" ;
workspace . renameFolder ( folderId , folderName , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function renameFolder () {
$folder_id = "1148746000002451001" ;
$folder_name = "Renamed folder" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> renameFolder ( $folder_id , $folder_name );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> renameFolder ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def rename_folder ( self , ac ):
folder_id = "1148746000002581001"
folder_name = "Renamed Folder 1"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . rename_folder ( folder_id , folder_name )
print ( "success" )
try :
obj = sample ()
obj . rename_folder ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var folderId = '' ;
var newFolderName = '' ;
var config = {};
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . renameFolder ( folderId , newFolderName , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
folderId = "35130000001362007" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
folderName = "Renamed Folder" ;
config = Map ();
config.put ( "folderName" , folderName );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/folders/" + folderId + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/folders/<folder-id>?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"folderName": "<folder-name>"
}
Sample Response:
HTTP/1.1 204 No Content
Rename a specified folder in the workspace.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/folders/<folder-id>
oauthscope: ZohoAnalytics.modeling.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
folderName*
String The new name of the folder.
folderDesc
String The new description of the folder.
Possible Error Codes
7103 , 7138 , 7277 , 8504 , 8506 , 8516
Make Default Folder
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
public void MakeDefaultFolder ( IAnalyticsClient ac )
{
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
long folderId = 1148746000002545001 ;
workspace . MakeDefaultFolder ( folderId );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . MakeDefaultFolder ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func MakeDefaultFolder ( ac ZAnalytics . Client ) {
folderid := "1767024000004595001"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . MakeDefaultFolder ( folderid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "Success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
MakeDefaultFolder ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . makeDefaultFolder ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void makeDefaultFolder ( AnalyticsClient ac ) throws Exception {
long folderId = 0 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . makeDefaultFolder ( folderId );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function makeDefaultFolder () {
$folder_id = "1767024000004595001" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> makeDefaultFolder ( $folder_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> makeDefaultFolder ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def make_default_folder ( self , ac ):
folder_id = "1767024000004419353"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . make_default_folder ( folder_id )
print ( "success" )
try :
obj = sample ()
obj . make_default_folder ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var folderId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . makeDefaultFolder ( folderId ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
folderId = "5812000000102348" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/folders/" + folderId + "/default"
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/folders/<folder-id>/default
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample Response:
HTTP/1.1 204 No Content
Make the specified folder as default in the workspace.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/folders/<folder-id>/default
oauthscope: ZohoAnalytics.modeling.update
Possible Error Codes
7103 , 7144 , 8504 , 8506
Delete Folder
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void DeleteFolder ( IAnalyticsClient ac )
{
long folderId = 1148746000002559043 ;
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . DeleteFolder ( folderId );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . DeleteFolder ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func DeleteFolder ( ac ZAnalytics . Client ) {
folderid := "35130000001400167"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . DeleteFolder ( folderid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
DeleteFolder ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . deleteFolder ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void deleteFolder ( AnalyticsClient ac ) throws Exception {
long folderId = 35130000001400167 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . deleteFolder ( folderId );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function deleteFolder () {
$folder_id = "1148746000002451001" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> deleteFolder ( $folder_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> deleteFolder ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def delete_folder ( self , ac ):
folder_id = "1148746000002581001"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . delete_folder ( folder_id )
print ( "success" )
try :
obj = sample ()
obj . delete_folder ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var folderId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . deleteFolder ( folderId ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
folderId = "35130000001362007" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/folders/" + folderId
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/folders/<folder-id>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Delete a specified folder in the workspace.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/folders/<folder-id>
oauthscope: ZohoAnalytics.modeling.delete
Possible Error Codes
7103 , 7138 , 7277 , 8504 , 8506 , 8516
Add Column
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void AddColumn ( IAnalyticsClient ac )
{
string columnName = "Add col" ;
string dataType = "PLAIN" ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
long columnId = view . AddColumn ( columnName , dataType , null );
Console . WriteLine ( columnId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AddColumn ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func AddColumn ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
columnname := "Added Column"
datatype := "NUMBER"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , exception := view . AddColumn ( columnname , datatype , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AddColumn ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . addColumn ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void addColumn ( AnalyticsClient ac ) throws Exception {
String columnName = "" ;
String dataType = "" ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
long result = view . addColumn ( columnName , dataType , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function addColumn () {
$column_name = "New Column" ;
$data_type = "PLAIN" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> addColumn ( $column_name , $data_type );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> addColumn ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def add_column ( self , ac ):
column_name = "Col 1"
data_type = "PLAIN"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . add_column ( column_name , data_type )
print ( result )
try :
obj = sample ()
obj . add_column ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var columnName = '' ;
var dataType = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . addColumn ( columnName , dataType , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
columnName = "Col 1" ;
dataType = "PLAIN" ;
config = Map ();
config.put ( "columnName" , columnName );
config.put ( "dataType" , dataType );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/columns"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"columnName": "<column-name>",
"dataType": "<data-type>",
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Add column" ,
"data" : {
"columnId" : "1767024000003145067"
}
}
Add a column in the specified table.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
columnName*
String The name of the column.
dataType*
String The data type of the column. supported data types:PLAIN MULTI_LINE EMAIL NUMBER POSITIVE_NUMBER DECIMAL_NUMBER CURRENCY PERCENT DATE BOOLEAN URL AUTO_NUMBER
Possible Error Codes
7103 , 7128 , 7138 , 7161 , 8504 , 8506 , 8516
Rename Column
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void RenameColumn ( IAnalyticsClient ac )
{
long columnId = 1148746000002557002 ;
string columnName = "Renamed column" ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . RenameColumn ( columnId , columnName );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RenameColumn ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func RenameColumn ( ac ZAnalytics . Client ) {
columnid := "1148746000002515001"
columnname := "Renamed Column"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . RenameColumn ( columnid , columnname )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RenameColumn ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . renameColumn ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void renameColumn ( AnalyticsClient ac ) throws Exception {
long columnId = 1148746000002515001 l ;
String columnName = "" ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . renameColumn ( columnId , columnName );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function renameColumn () {
$column_id = "1148746000002453001" ;
$column_name = "Renamed Col" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> renameColumn ( $column_id , $column_name );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> renameColumn ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def rename_column ( self , ac ):
column_id = "35130000001055095"
column_name = "Renamed Col"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . rename_column ( column_id , column_name )
print ( "success" )
try :
obj = sample ()
obj . rename_column ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var columnId = '' ;
var newColumnName = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . renameColumn ( columnId , newColumnName ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
columnId = "1148746000002453001" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
columnName = "New Name" ;
config = Map ();
config.put ( "columnName" , columnName );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/columns/" + columnId + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/<column-id>?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"columnName": "<column-name>"
}
Sample Response:
HTTP/1.1 204 No Content
Rename a specified column in the table.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/<column-id>
oauthscope: ZohoAnalytics.modeling.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
columnName*
String The new name of the column.
Possible Error Codes
7103 , 7107 , 7138 , 7128 , 8504 , 8506 , 8516
Delete Column
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void DeleteColumn ( IAnalyticsClient ac )
{
long columnId = 1148746000002557002 ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . DeleteColumn ( columnId , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . DeleteColumn ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func DeleteColumn ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
columnid := "1148746000002515001"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . DeleteColumn ( columnid , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
DeleteColumn ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . deleteColumn ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void deleteColumn ( AnalyticsClient ac ) throws Exception {
long columnId = 1148746000002515001 l ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . deleteColumn ( columnId , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function deleteColumn () {
$column_id = "1148746000002453001" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> deleteColumn ( $column_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> deleteColumn ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def delete_column ( self , ac ):
column_id = "1148746000002578003"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . delete_column ( column_id )
print ( "success" )
try :
obj = sample ()
obj . delete_column ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var columnId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . deleteColumn ( columnId , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
columnId = "1148746000002453001" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/columns/" + columnId
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/<column-id>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Delete a specified column in the table.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/<column-id>
oauthscope: ZohoAnalytics.modeling.delete
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
deleteDependentViews
Boolean To delete column with dependent views.
Possible Error Codes
7103 , 7107 , 7138 , 7159 , 8504 , 8506 , 8516
Add Lookup
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void AddLookup ( IAnalyticsClient ac )
{
long columnId = 1148746000002449006 ;
long refViewId = 1148746000002449089 ;
long refColumnId = 1148746000002449094 ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . AddLookup ( columnId , refViewId , refColumnId , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AddLookup ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func AddLookup ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
columnid := "1148746000002449006"
refviewId := "1148746000002449089"
refcolumnid := "1148746000002449094"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . AddLookup ( columnid , refviewId , refcolumnid , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AddLookup ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . addLookup ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void addLookup ( AnalyticsClient ac ) throws Exception {
long columnId = 1148746000002515001 l ;
long refViewId = 1148746000002449089 l ;
long refColumnId = 1148746000002449094 l ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . addLookup ( columnId , refViewId , refColumnId , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function createLookup () {
$column_id = "1148746000002449094" ;
$ref_view_id = "35730000007354002" ;
$ref_column_id = "1148746000002449006" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> createLookup ( $column_id , $ref_view_id , $ref_column_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> createLookup ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def add_lookup ( self , ac ):
column_id = "1148746000002449006"
ref_view_id = "1148746000002449089"
ref_column_id = "1148746000002449094"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . add_lookup ( column_id , ref_view_id , ref_column_id )
print ( "success" )
try :
obj = sample ()
obj . add_lookup ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var columnId = '' ;
var refViewId = '' ;
var refColumnId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . addLookup ( columnId , refViewId , refColumnId , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
columnId = "1148746000002453001" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
config = Map ();
config.put ( "referenceViewId" , "" );
config.put ( "referenceColumnId" , "" );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/columns/" + columnId + "/lookup"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/<column-id>/lookup?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"referenceViewId": "<view-id>",
"referenceColumnId": "<column-id>"
}
Sample Response:
HTTP/1.1 204 No Content
Add a lookup in the specified child table.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/<column-id>/lookup
oauthscope: ZohoAnalytics.modeling.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
referenceViewId*
Long
The reference view id.
referenceColumnId*
Long
The reference column id.
Possible Error Codes
7103 , 7107 , 7138 , 8504 , 8506 , 8516
Remove Lookup
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void RemoveLookup ( IAnalyticsClient ac )
{
long columnId = 1148746000002449006 ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . RemoveLookup ( columnId , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RemoveLookup ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func RemoveLookup ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
columnid := "1148746000002449006"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . RemoveLookup ( columnid , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RemoveLookup ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . removeLookup ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void removeLookup ( AnalyticsClient ac ) throws Exception {
long columnId = 1148746000002449006 l ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . removeLookup ( columnId , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function removeLookup () {
$column_id = "1148746000002449094" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> removeLookup ( $column_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> removeLookup ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def remove_lookup ( self , ac ):
column_id = "1148746000002449006"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . remove_lookup ( column_id )
print ( "success" )
try :
obj = sample ()
obj . remove_lookup ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var columnId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . removeLookup ( columnId , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
columnId = "1148746000002453001" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/columns/" + columnId + "/lookup"
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/<column-id>/lookup
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Remove the lookup for the specified column in the table.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/<column-id>/lookup
oauthscope: ZohoAnalytics.modeling.update
Possible Error Codes
7103 , 7107 , 7138 , 8504 , 8506 , 8516
Hide Columns
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void HideColumns ( IAnalyticsClient ac )
{
List < long > columnIds = new List < long >();
columnIds . Add ( 1148746000002449006 );
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . HideColumns ( columnIds );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . HideColumns ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func HideColumns ( ac ZAnalytics . Client ) {
columnids := [ 2 ] string {}
columnids [ 0 ] = "1148746000002449007"
columnids [ 1 ] = "1148746000002449008"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . HideColumns ( columnids )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
HideColumns ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . hideColumns ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void hideColumns ( AnalyticsClient ac ) throws Exception {
JSONArray columnIds = new JSONArray ();
columnIds . put ( "35730000007354002" );
columnIds . put ( "35730000007355003" );
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . hideColumns ( columnIds );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function hideColumns () {
$column_ids = array ( "1148746000002449094" , "1148746000002449095" );
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> hideColumns ( $column_ids );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> hideColumns ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def hide_columns ( self , ac ):
column_ids = []
column_ids . append ( "1148746000002449006" )
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . hide_columns ( column_ids )
print ( "success" )
try :
obj = sample ()
obj . hide_columns ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var columnIds = [];
columnIds . push ( "" );
columnIds . push ( "" );
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . hideColumns ( columnIds ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
columns = {};
columns.add ( "35130000001360048" );
config = Map ();
config.put ( "columnIds" , columns );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/columns/hide" + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/hide?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"columnIds": ["<column-id1>", "<column-id2>"]
}
Sample Response:
HTTP/1.1 204 No Content
Hide the specified columns in the table.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/hide
oauthscope: ZohoAnalytics.modeling.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
columnIds*
JSONArray The column ids to be hidden.Sample: ["columnId1","columnId2"]
Possible Error Codes
7103 , 7107 , 7138 , 8504 , 8506 , 8516
Show Columns
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void ShowColumns ( IAnalyticsClient ac )
{
List < long > columnIds = new List < long >();
columnIds . Add ( 1148746000002449006 );
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . ShowColumns ( columnIds );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . ShowColumns ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func ShowColumns ( ac ZAnalytics . Client ) {
columnids := [ 2 ] string {}
columnids [ 0 ] = "1148746000002449007"
columnids [ 1 ] = "1148746000002449008"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . ShowColumns ( columnids )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
ShowColumns ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . showColumns ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void showColumns ( AnalyticsClient ac ) throws Exception {
JSONArray columnIds = new JSONArray ();
columnIds . put ( "35730000007354002" );
columnIds . put ( "35730000007355003" );
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . showColumns ( columnIds );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function showColumns () {
$column_ids = array ( "1148746000002449094" , "1148746000002449095" );
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> showColumns ( $column_ids );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> showColumns ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def show_columns ( self , ac ):
column_ids = []
column_ids . append ( "1148746000002449006" )
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . show_columns ( column_ids )
print ( "success" )
try :
obj = sample ()
obj . show_columns ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var columnIds = [];
columnIds . push ( "" );
columnIds . push ( "" );
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . showColumns ( columnIds ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
columns = {};
columns.add ( "35130000001360048" );
config = Map ();
config.put ( "columnIds" , columns );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/columns/show" + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/show?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"columnIds": ["<column-id1>", "<column-id2>"]
}
Sample Response:
HTTP/1.1 204 No Content
Show the specified hidden columns in the table.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/columns/show
oauthscope: ZohoAnalytics.modeling.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
columnIds*
JSONArray The column ids to be shown.Sample: ["columnId1","columnId2"]
Possible Error Codes
7103 , 7107 , 7138 , 8504 , 8506 , 8516
Copy Views
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void CopyViews ( IAnalyticsClient ac )
{
List < long > viewIds = new List < long >();
viewIds . Add ( 1148746000002457001 );
long destWorkspaceId = 1148746000002556007 ;
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
List < Dictionary < string , object >> views = ws . CopyViews ( viewIds , destWorkspaceId , null , null );
Console . WriteLine ( views );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CopyViews ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func CopyViews ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
destworkspaceid := "35130000001055707"
destorgid := ""
viewids := [ 2 ] string {}
viewids [ 0 ] = "1148746000002449007"
viewids [ 1 ] = "1148746000002449008"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . CopyViews ( viewids , destworkspaceid , config , destorgid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CopyViews ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . copyViews ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void copyViews ( AnalyticsClient ac ) throws Exception {
JSONArray viewIds = new JSONArray ();
viewIds . put ( 35730000007354002l );
long destWorkspaceId = 35130000001055707 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray result = workspace . copyViews ( viewIds , destWorkspaceId , null , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function copyViews () {
$dest_workspace_id = "1148746000002449089" ;
$view_ids = array ( "1148746000002449094" , "1148746000002449095" );
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> copyViews ( $view_ids , $dest_workspace_id );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> copyViews ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def copy_views ( self , ac ):
view_ids = []
view_ids . append ( "1148746000002457001" )
dest_workspace_id = "1148746000002575005"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . copy_views ( view_ids , dest_workspace_id )
print ( result )
try :
obj = sample ()
obj . copy_views ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var destWorkspaceId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var viewIds = [];
viewIds . push ( "" );
viewIds . push ( "" );
var config = {};
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . copyViews ( viewIds , destWorkspaceId , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
views = {};
views.add ( "35130000001360048" );
destWorkspaceId = "35130000001677807" ;
config = Map ();
config.put ( "viewIds" , views );
config.put ( "destWorkspaceId" , destWorkspaceId );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/copy"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<source-workspace-id>/views/copy?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <source-org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"viewIds": ["<view-id1>", "<view-id2>"],
"destWorkspaceId": "<workspace-id>"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Copy views" ,
"data" : {
"views" : [
{
"sourceViewId" : "1767024000004221089" ,
"destViewId" : "2102449000000625001"
} ,
{
"sourceViewId" : "1767024000004221093" ,
"destViewId" : "2102449000000625005"
}
]
}
}
Copy the specified views from one workspace to another workspace.
Note: For ZANALYTICS-ORGID header, provide the source organization id as the value.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<source-workspace-id>/views/copy
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
viewIds*
JSONArray The id of the views to be copied.Sample: ["viewId1","viewId2"]
destWorkspaceId*
Long
The destination workspace id.
workspaceKey
String The secret key used for allowing the user to copy the views from one organization to another organization.
copyWithData
Boolean To copy the table with data.
copyWithDependentViews
Boolean The copy the views with dependents.
Name
Value
Description
ZANALYTICS-DEST-ORGID
<destination-org-id>
Id of the organization where the destination workspace is present.
Possible Error Codes
7103 , 7138 , 8504 , 8506 , 8516 , 15000 , 15001 , 15002 , 15005 , 15007 , 15012
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void CopyFormulas ( IAnalyticsClient ac )
{
List < string > formulaNames = new List < string >();
formulaNames . Add ( "F1" );
long destWorkspaceId = 1148746000002556007 ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . CopyFormulas ( formulaNames , destWorkspaceId , null , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CopyFormulas ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func CopyFormulas ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
destworkspaceid := ""
destorgid := ""
formulanames := [ 2 ] string {}
formulanames [ 0 ] = "F1"
formulanames [ 1 ] = "F2"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . CopyFormulas ( formulanames , destworkspaceid , config , destorgid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CopyFormulas ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . copyFormulas ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void copyFormulas ( AnalyticsClient ac ) throws Exception {
JSONArray formulaNames = new JSONArray ();
long destWorkspaceId = 35130000001055707 l ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . copyFormulas ( formulaNames , destWorkspaceId , null , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function copyFormulas () {
$dest_workspace_id = "1148746000002449089" ;
$formula_names = array ( "F1" , "F2" );
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> copyFormulas ( $formula_names , $dest_workspace_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> copyFormulas ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def copy_formulas ( self , ac ):
formula_names = []
formula_names . append ( "F1" )
dest_workspace_id = "1148746000002575005"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . copy_formulas ( formula_names , dest_workspace_id )
print ( "success" )
try :
obj = sample ()
obj . copy_formulas ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var destWorkspaceId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var formulaNames = [];
formulaNames . push ( '' );
formulaNames . push ( '' );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . copyFormulas ( formulaNames , destWorkspaceId , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
formulaNames = {};
formulaNames.add ( "Add_Cost" );
destWorkspaceId = "35130000001677807" ;
config = Map ();
config.put ( "formulaColumnNames" , formulaNames );
config.put ( "destWorkspaceId" , destWorkspaceId );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/formulas/copy"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<source-workspace-id>/views/<source-view-id>/formulas/copy?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <source-org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"formulaColumnNames": ["<column-name1>", "<column-name2>"],
"destWorkspaceId": "<workspace-id>"
}
Sample Response:
HTTP/1.1 204 No Content
Copy the specified formulas from one table to another across workspaces.
Note:
For ZANALYTICS-ORGID header, provide the source organization id as the value. As of now copying formulas within the same workspace is not possible.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<source-workspace-id>/views/<source-view-id>/formulas/copy
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
formulaColumnNames*
JSONArray The name of the formula columns to be copied.Sample: ["column1","column2"]
destWorkspaceId*
Long
The destination workspace id.
workspaceKey
String The secret key used for allowing the user to copy the formulas from one organization to another organization.
Name
Value
Description
ZANALYTICS-DEST-ORGID
<destination-org-id>
Id of the organization where the destination workspace is present.
Possible Error Codes
7103 , 7138 , 8504 , 8506 , 8516 , 15002 , 15007 , 15009 , 15010
Create Similar Views
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void CreateSimilarViews ( IAnalyticsClient ac )
{
long refViewId = 35730000007354002 ;
long folderId = 1148746000002508116 ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . CreateSimilarViews ( refViewId , folderId , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CreateSimilarViews ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func CreateSimilarViews ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
refviewid := "35730000007354002"
folderid := "1148746000002508116"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . CreateSimilarViews ( refviewid , folderid , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CreateSimilarViews ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . createSimilarViews ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void createSimilarViews ( AnalyticsClient ac ) throws Exception {
long refViewId = 35730000007354002 l ;
long folderId = 1148746000002508116 l ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . createSimilarViews ( refViewId , folderId , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function createSimilarViews () {
$ref_view_id = "35730000007354002" ;
$folder_id = "1148746000002449073" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> createSimilarViews ( $ref_view_id , $folder_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> createSimilarViews ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def create_similar_views ( self , ac ):
ref_view_id = "35730000007354002"
folder_id = "1148746000002508116"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . create_similar_views ( ref_view_id , folder_id )
print ( "success" )
try :
obj = sample ()
obj . create_similar_views ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var refViewId = '' ;
var folderId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . createSimilarViews ( refViewId , folderId , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
config = Map ();
config.put ( "referenceViewId" , "" );
config.put ( "folderId" , "" );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/similarviews"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<source-workspace-id>/views/<view-id>/similarviews?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"referenceViewId": "<view-id>",
"folderId": "<folder-id>"
}
Sample Response:
HTTP/1.1 204 No Content
Create reports for the specified table based on the reference table.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<source-workspace-id>/views/<view-id>/similarviews
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
referenceViewId*
Long
The reference view id.
folderId*
Long
The folder id where the views to be saved.
Possible Error Codes
7103 , 7138 , 7144 , 8504 , 8506 , 8516
Auto Analyse View
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void AutoAnalyseView ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . AutoAnalyse ( null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AutoAnalyseView ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func AutoAnalysisView ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . AutoAnalyse ( config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AutoAnalysisView ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . autoAnalyseView ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void autoAnalyseView ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . autoAnalyse ( null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function autoAnalysisView () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> autoAnalyse ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> autoAnalysisView ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def auto_analysis_view ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . auto_analyse ()
print ( "success" )
try :
obj = sample ()
obj . auto_analysis_view ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . autoAnalyse ( config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/autoanalyse"
type : POST
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<source-workspace-id>/views/<view-id>/autoanalyse
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Auto generate reports for the specified table.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<source-workspace-id>/views/<view-id>/autoanalyse
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
analyseAgain
Boolean To generate duplicate reports if reports generated before.
Possible Error Codes
7103 , 7107 , 7138 , 8504 , 8506 , 8516
Auto Analyse Column
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void AutoAnalysisColumn ( IAnalyticsClient ac )
{
long columnId = 1148746000002449006 ;
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . AutoAnalyseColumn ( columnId , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AutoAnalysisColumn ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func AutoAnalyseColumn ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
columnid := "1148746000002508122"
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . AutoAnalyseColumn ( columnid , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AutoAnalyseColumn ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . autoAnalyseColumn ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void autoAnalyseColumn ( AnalyticsClient ac ) throws Exception {
long columnId = 1148746000002508122 l ;
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . autoAnalyseColumn ( columnId , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function autoAnalyseColumn () {
$column_id = "35130000001352010" ;
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> autoAnalyseColumn ( $column_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> autoAnalyseColumn ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def auto_analyse_column ( self , ac ):
column_id = "1148746000002449006"
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . auto_analyse_column ( column_id )
print ( "success" )
try :
obj = sample ()
obj . auto_analyse_column ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var columnId = '1148746000002449006' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . autoAnalyseColumn ( columnId ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
columnId = "1148746000002449006" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/columns/" + columnId + "/autoanalyse"
type : POST
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<source-workspace-id>/views/<view-id>/columns/<column-id>/autoanalyse
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Auto generate reports for the specified column.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<source-workspace-id>/views/<view-id>/columns/<column-id>/autoanalyse
oauthscope: ZohoAnalytics.modeling.create
Possible Error Codes
7103 , 7107 , 7138 , 8504 , 8506 , 8516
Get Variables
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
public void GetVariables ( IAnalyticsClient ac )
{
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
List < Dictionary < string , object >> variables = workspace . GetVariables ();
Console . WriteLine ( variables );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetVariables ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetVariables ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetVariables ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetVariables ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getVariables ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getVariables ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray result = workspace . getVariables ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getVariables () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getVariables ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getVariables ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_variables ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_variables ()
print ( result )
try :
obj = sample ()
obj . get_variables ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getVariables (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/variables"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/variables
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset= UTF-8
{
"status" :"success" ,
"summary" :"Get variables" ,
"data" :{
"variables" :[
{
"variableName" :"Variable - 1" ,
"variableId" :"137687000007146340" ,
"variableType" :"0" ,
"variableDataType" :"1"
} ,
{
"variableName" :"Variable - 2" ,
"variableId" :"137687000007146338" ,
"variableType" :"3" ,
"variableDataType" :"1"
}
]
}
}
Returns list of variables for the specified workspace.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/variables
oauthscope: ZohoAnalytics.modeling.read
Possible Error Codes
7103 ,
7301 ,
8083 ,
8518 ,
8535
Get Variable Details
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
public void GetVariableDetails ( IAnalyticsClient ac )
{
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
long variableId = 1148746000002545001 ;
Dictionary < string , object > variableDetails = workspace . GetVariableDetails ( variableId );
Console . WriteLine ( variableDetails );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetVariableDetails ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetVariableDetails ( ac ZAnalytics . Client ) {
variableid := "1767024000004594001"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetVariableDetails ( variableid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetVariableDetails ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getVariableDetails ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getVariableDetails ( AnalyticsClient ac ) throws Exception {
long variableId = 0 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONObject result = workspace . getVariableDetails ( variableId );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getVariableDetails () {
$variable_id = "1767024000004613001" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getVariableDetails ( $variable_id );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getVariableDetails ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_variable_details ( self , ac ):
variable_id = "1767024000004598005"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_variable_details ( variable_id )
print ( result )
try :
obj = sample ()
obj . get_variable_details ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var variableId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getVariableDetails ( variableId ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
variableId = "25120000001037713" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/variables/" + variableId
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/variables/<variable-id>
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset= UTF-8
{
"status" :"success" ,
"summary" :"Get variable details" ,
"data" :{
"variableName" :"Variable - 2" ,
"variableType" :0,
"variableDataType" :1,
"userSpecificData" :[
{
"values" :[
"4" ,
"5" ,
"6"
] ,
"defaultValue" :"4" ,
"emailIds" :[
"user+1@zoho.com"
]
} ,
{
"values" :[
"7" ,
"8" ,
"9"
] ,
"defaultValue" :"7" ,
"emailIds" :[
"user+2@zoho.com"
]
}
] ,
"defaultData" :{
"values" :[
"1" ,
"2" ,
"3"
] ,
"defaultValue" :"1"
} ,
"format" :{
"alignment" :"Left"
}
}
}
Returns details of the specified variable.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/variables/<variable-id>
oauthscope: ZohoAnalytics.modeling.read
Possible Error Codes
7103 ,
7301 ,
8083 ,
8518 ,
8535 ,
70329
Create Variable
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
public void CreateVariable ( IAnalyticsClient ac )
{
string variableName = "Variable_1" ;
int variableDataType = 1 ;
int variableType = 3 ;
Dictionary < string , object > format = new Dictionary < string , object >();
format . Add ( "alignment" , "left" );
List < string > emailIds_1 = new List < string >();
emailIds_1 . Add ( "user+1@zoho.com" );
emailIds_1 . Add ( "user+2@zoho.com" );
List < string > values_1 = new List < string >();
values_1 . Add ( "1" );
values_1 . Add ( "2" );
values_1 . Add ( "3" );
Dictionary < string , object > dataset_1 = new Dictionary < string , object >();
dataset_1 . Add ( "values" , values_1 );
dataset_1 . Add ( "emailIds" , emailIds_1 );
List < string > emailIds_2 = new List < string >();
emailIds_2 . Add ( "user+3@zoho.com" );
emailIds_2 . Add ( "user+4@zoho.com" );
List < string > values_2 = new List < string >();
values_2 . Add ( "4" );
values_2 . Add ( "5" );
values_2 . Add ( "6" );
Dictionary < string , object > dataset_2 = new Dictionary < string , object >();
dataset_2 . Add ( "values" , values_2 );
dataset_2 . Add ( "emailIds" , emailIds_2 );
List < object > userSpecificData = new List < object >();
userSpecificData . Add ( dataset_1 );
userSpecificData . Add ( dataset_2 );
Dictionary < string , object > config = new Dictionary < string , object >();
config . Add ( "format" , format );
config . Add ( "userSpecificData" , userSpecificData );
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
long variableId = workspace . CreateVariable ( variableName , variableDataType , variableType , config );
Console . WriteLine ( variableId );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CreateVariable ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func CreateVariable ( ac ZAnalytics . Client ) {
variablename := "Variable_1"
variabledatatype := 1
variabletype := 3
values_1 := [ 2 ] string {}
values_1 [ 0 ] = "1"
values_1 [ 1 ] = "2"
emailids_1 := [ 1 ] string {}
emailids_1 [ 0 ] = "user+1@zoho.com"
dataset_1 := map [ string ] interface {}{}
dataset_1 [ "values" ] = values_1
dataset_1 [ "emailIds" ] = emailids_1
values_2 := [ 2 ] string {}
values_2 [ 0 ] = "3"
values_2 [ 1 ] = "4"
emailids_2 := [ 1 ] string {}
emailids_2 [ 0 ] = "user+2@zoho.com"
dataset_2 := map [ string ] interface {}{}
dataset_2 [ "values" ] = values_2
dataset_2 [ "emailIds" ] = emailids_2
userspecificdata := [ 2 ] map [ string ] interface {}{}
userspecificdata [ 0 ] = dataset_1
userspecificdata [ 1 ] = dataset_2
format := map [ string ] interface {}{}
format [ "alignment" ] = "left"
config := map [ string ] interface {}{}
config [ "userSpecificData" ] = userspecificdata
config [ "format" ] = format
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . CreateVariable ( variablename , variabledatatype , variabletype , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CreateVariable ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . createVariable ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void createVariable ( AnalyticsClient ac ) throws Exception {
String variableName = "Variable_1" ;
int variableDataType = 1 ;
int variableType = 3 ;
JSONObject format = new JSONObject ();
format . put ( "alignment" , "left" );
JSONArray values_1 = new JSONArray ();
values_1 . put ( "1" );
values_1 . put ( "2" );
JSONArray emailIds_1 = new JSONArray ();
emailIds_1 . put ( "user+1@zoho.com" );
emailIds_1 . put ( "user+2@zoho.com" );
JSONArray values_2 = new JSONArray ();
values_2 . put ( "3" );
values_2 . put ( "4" );
JSONArray emailIds_2 = new JSONArray ();
emailIds_2 . put ( "user+3@zoho.com" );
emailIds_2 . put ( "user+4@zoho.com" );
JSONObject dataset_1 = new JSONObject ();
dataset_1 . put ( "values" , values_1 );
dataset_1 . put ( "emailIds" , emailIds_1 );
JSONObject dataset_2 = new JSONObject ();
dataset_2 . put ( "values" , values_2 );
dataset_2 . put ( "emailIds" , emailIds_2 );
JSONArray userSpecificData = new JSONArray ();
userSpecificData . put ( dataset_1 );
userSpecificData . put ( dataset_2 );
JSONObject config = new JSONObject ();
config . put ( "format" , format );
config . put ( "userSpecificData" , userSpecificData );
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
long result = workspace . createVariable ( variableName , variableDataType , variableType , config );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function createVariable () {
$variable_name = "Variable 2" ;
$variable_datatype = "1" ;
$variable_type = "3" ;
$format = array ();
$format [ "alignment" ] = "left" ;
$values_1 = array ( "1" , "2" );
$email_ids_1 = array ( "user+1@zohotest.com" , "user+2@zohotest.com" );
$dataset_1 = array ();
$dataset_1 [ "values" ] = $values_1 ;
$dataset_1 [ "emailIds" ] = $email_ids_1 ;
$values_2 = array ( "3" , "4" );
$email_ids_2 = array ( "user+3@zohotest.com" , "user+4@zohotest.com" );
$dataset_2 = array ();
$dataset_2 [ "values" ] = $values_2 ;
$dataset_2 [ "emailIds" ] = $email_ids_2 ;
$user_specific_data = array ( $dataset_1 , $dataset_2 );
$config = array ();
$config [ "format" ] = $format ;
$config [ "userSpecificData" ] = $user_specific_data ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> createVariable ( $variable_name , $variable_datatype , $variable_type , $config );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> createVariable ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def create_variable ( self , ac ):
variable_name = "Variable 1"
variable_datatype = "1"
variable_type = "3"
variable_format = {}
variable_format [ "alignment" ] = "left"
values_1 = []
values_1 . append ( "1" )
values_1 . append ( "2" )
email_ids_1 = []
email_ids_1 . append ( "user+1@zoho.com" )
email_ids_1 . append ( "user+2@zoho.com" )
dataset_1 = {}
dataset_1 [ "values" ] = values_1
dataset_1 [ "emailIds" ] = email_ids_1
values_2 = []
values_2 . append ( "3" )
values_2 . append ( "4" )
email_ids_2 = []
email_ids_2 . append ( "user+3@zoho.com" )
email_ids_2 . append ( "user+4@zoho.com" )
dataset_2 = {}
dataset_2 [ "values" ] = values_2
dataset_2 [ "emailIds" ] = email_ids_2
user_specific_data = []
user_specific_data . append ( dataset_1 )
user_specific_data . append ( dataset_2 )
config = {}
config [ "format" ] = variable_format
config [ "userSpecificData" ] = user_specific_data
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . create_variable ( variable_name , variable_datatype , variable_type , config )
print ( result )
try :
obj = sample ()
obj . create_variable ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var variableName = "Variable_1" ;
var variableDataType = 1 ;
var variableType = 3 ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var format = {};
format [ "alignment" ] = "left" ;
var values_1 = [];
values_1 . push ( "1" );
values_1 . push ( "2" );
var emailIds_1 = [];
emailIds_1 . push ( "user+1@zoho.com" );
emailIds_1 . push ( "user+2@zoho.com" );
var dataset_1 = {};
dataset_1 [ "values" ] = values_1 ;
dataset_1 [ "emailIds" ] = emailIds_1 ;
var values_2 = [];
values_2 . push ( "3" );
values_2 . push ( "4" );
var emailIds_2 = [];
emailIds_2 . push ( "user+3@zoho.com" );
emailIds_2 . push ( "user+4@zoho.com" );
var dataset_2 = {};
dataset_2 [ "values" ] = values_2 ;
dataset_2 [ "emailIds" ] = emailIds_2 ;
var userSpecificData = [];
userSpecificData . push ( dataset_1 );
userSpecificData . push ( dataset_2 );
var config = {};
config [ "format" ] = format ;
config [ "userSpecificData" ] = userSpecificData ;
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . createVariable ( variableName , variableDataType , variableType , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
variableName = "Variable_1" ;
variableDataType = 1 ;
variableType = 3 ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
format = Map ();
format.put ( "alignment" , "left" );
values_1 = {};
values_1.add ( "1" );
values_1.add ( "2" );
emailIds_1 = {};
emailIds_1.add ( "user+1@zoho.com" );
emailIds_1.add ( "user+2@zoho.com" );
dataset_1 = Map ();
dataset_1.put ( "values" , values_1 );
dataset_1.put ( "emailIds" , emailIds_1 );
values_2 = {};
values_2.add ( "1" );
values_2.add ( "2" );
emailIds_2 = {};
emailIds_2.add ( "user+1@zoho.com" );
emailIds_2.add ( "user+2@zoho.com" );
dataset_2 = Map ();
dataset_2.put ( "values" , values_2 );
dataset_2.put ( "emailIds" , emailIds_2 );
userSpecificData = {};
userSpecificData.add ( dataset_1 );
userSpecificData.add ( dataset_2 );
config = Map ();
config.put ( "format" , format );
config.put ( "userSpecificData" , userSpecificData );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/variables"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/variables?CONFIG= <encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample value for CONFIG parameter:
Copy
{
"variableName":"Variable - 1",
"variableType":3,
"variableDataType":1,
"userSpecificData":[
{
"values":[
"4",
"5",
"6"
],
"emailIds":[
"user+1@zohotest.com"
]
},
{
"values":[
"1",
"2",
"3"
],
"emailIds":[
"user+2@zohotest.com"
]
}
],
"format":{
"alignment":"Left"
}
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset= UTF-8
{
"status" :"success" ,
"summary" :"Create variable" ,
"data" :{
"variableId" :"137687000006991651"
}
}
Create a variable in the specified workspace.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/variables
oauthscope: ZohoAnalytics.modeling.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
variableName*
String Name of the variable.
variableDatatype
Integer Datatype of the variable.
1 - PLAIN
4 - NUMBER
5 - POSITIVE_NUMBER
6 - DECIMAL_NUMBER
7 - CURRENCY
8 - PERCENT
variableType
Integer Type of the variable.
0 - LIST
1 - RANGE
2 - ALL_VALUES
format
JSONObject Variable format.
Refer FORMAT JSON Structure.
userSpecificData
JSONArray Array of user specfic values.
Refer USER_SPECIFIC_DATA JSON Structure.
defaultData
JSONObject Default value for the variable.
Mandatory for LIST and RANGE variable type.
Refer DEFAULT_DATA JSON Structure.
Key
Description
alignment
String
decimalPlaces
Integer -1 to 10
currencySymbol
String <CURRENCY_SYMBOL> Sample : en;US;
showNegativeSign
Boolean true / false
userLocale
Boolean true / false
thousandSeparator
Integer
0 - NONE
1 - COMMA
2 - DOT
3 - SPACE
4 - SINGLE_QUOTE
decimalSeparator
Integer
showPercent
Boolean true / false Valid only for PERCENT format type.
USER_SPECIFIC_DATA structure
Key
Description
values
JSONArray Array of valuesSample : ["Value_1","Value_2"]
emailIds
JSONArray Array of EmailIdsSample : ["user+1@zoho.com","user+2@zoho.com"]
defaultValue
String Default value for the variable. Mandatory for RANGE variable type.
minValue
String Minimum value for the variable. Mandatory for RANGE variable type.
maxValue
String Maximum value for the variable. Mandatory for RANGE variable type.
stepSize
String Incremental value for the variable. Mandatory for RANGE variable type.
domainName
String Name of the domain To add variable values to the white label domain users.
DEFAULT_DATA structure
Key
Description
values
JSONArray Array of valuesSample : ["Value_1","Value_2"] Mandatory for LIST variable type.
defaultValue
String Default value for the variable. Mandatory for RANGE variable type.
minValue
String Minimum value for the variable. Mandatory for RANGE variable type.
maxValue
String Maximum value for the variable. Mandatory for RANGE variable type.
stepSize
String Incremental value for the variable. Mandatory for RANGE variable type.
Possible Error Codes
7103 ,
7301 ,
8083 ,
8504 ,
8516 ,
8518 ,
8535 ,
70323
Update Variable
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
public void UpdateVariable ( IAnalyticsClient ac )
{
long variableId = 1148746000002545001 ;
string variableName = "Variable_NEW_1" ;
int variableDataType = 1 ;
int variableType = 3 ;
Dictionary < string , object > format = new Dictionary < string , object >();
format . Add ( "alignment" , "left" );
List < string > emailIds_1 = new List < string >();
emailIds_1 . Add ( "user+1@zoho.com" );
emailIds_1 . Add ( "user+2@zoho.com" );
List < string > values_1 = new List < string >();
values_1 . Add ( "4" );
values_1 . Add ( "5" );
values_1 . Add ( "6" );
Dictionary < string , object > dataset_1 = new Dictionary < string , object >();
dataset_1 . Add ( "values" , values_1 );
dataset_1 . Add ( "emailIds" , emailIds_1 );
List < string > emailIds_2 = new List < string >();
emailIds_2 . Add ( "user+3@zoho.com" );
emailIds_2 . Add ( "user+4@zoho.com" );
List < string > values_2 = new List < string >();
values_2 . Add ( "1" );
values_2 . Add ( "2" );
values_2 . Add ( "3" );
Dictionary < string , object > dataset_2 = new Dictionary < string , object >();
dataset_2 . Add ( "values" , values_2 );
dataset_2 . Add ( "emailIds" , emailIds_2 );
List < object > userSpecificData = new List < object >();
userSpecificData . Add ( dataset_1 );
userSpecificData . Add ( dataset_2 );
Dictionary < string , object > config = new Dictionary < string , object >();
config . Add ( "format" , format );
config . Add ( "userSpecificData" , userSpecificData );
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
workspace . UpdateVariable ( variableId , variableName , variableDataType , variableType , config );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . UpdateVariable ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func UpdateVariable ( ac ZAnalytics . Client ) {
variableid := "1767024000004594001"
variablename := "Variable_11"
variabledatatype := 1
variabletype := 3
values_1 := [ 2 ] string {}
values_1 [ 0 ] = "1"
values_1 [ 1 ] = "2"
emailids_1 := [ 1 ] string {}
emailids_1 [ 0 ] = "user+1@zoho.com"
dataset_1 := map [ string ] interface {}{}
dataset_1 [ "values" ] = values_1
dataset_1 [ "emailIds" ] = emailids_1
values_2 := [ 2 ] string {}
values_2 [ 0 ] = "3"
values_2 [ 1 ] = "4"
emailids_2 := [ 1 ] string {}
emailids_2 [ 0 ] = "user+2@zoho.com"
dataset_2 := map [ string ] interface {}{}
dataset_2 [ "values" ] = values_2
dataset_2 [ "emailIds" ] = emailids_2
userspecificdata := [ 2 ] map [ string ] interface {}{}
userspecificdata [ 0 ] = dataset_1
userspecificdata [ 1 ] = dataset_2
format := map [ string ] interface {}{}
format [ "alignment" ] = "left"
config := map [ string ] interface {}{}
config [ "userSpecificData" ] = userspecificdata
config [ "format" ] = format
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . UpdateVariable ( variableid , variablename , variabledatatype , variabletype , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "Success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
UpdateVariable ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . updateVariable ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void updateVariable ( AnalyticsClient ac ) throws Exception {
long variableId = 0 l ;
String variableName = "Variable_2" ;
int variableDataType = 1 ;
int variableType = 3 ;
JSONObject format = new JSONObject ();
format . put ( "alignment" , "right" );
JSONArray values_1 = new JSONArray ();
values_1 . put ( "11" );
values_1 . put ( "12" );
JSONArray emailIds_1 = new JSONArray ();
emailIds_1 . put ( "user+1@zoho.com" );
emailIds_1 . put ( "user+2@zoho.com" );
JSONArray values_2 = new JSONArray ();
values_2 . put ( "13" );
values_2 . put ( "14" );
JSONArray emailIds_2 = new JSONArray ();
emailIds_2 . put ( "user+3@zoho.com" );
emailIds_2 . put ( "user+4@zoho.com" );
JSONObject dataset_1 = new JSONObject ();
dataset_1 . put ( "values" , values_1 );
dataset_1 . put ( "emailIds" , emailIds_1 );
JSONObject dataset_2 = new JSONObject ();
dataset_2 . put ( "values" , values_2 );
dataset_2 . put ( "emailIds" , emailIds_2 );
JSONArray userSpecificData = new JSONArray ();
userSpecificData . put ( dataset_1 );
userSpecificData . put ( dataset_2 );
JSONObject config = new JSONObject ();
config . put ( "format" , format );
config . put ( "userSpecificData" , userSpecificData );
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . updateVariable ( variableId , variableName , variableDataType , variableType , config );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function updateVariable () {
$variable_id = "1767024000004613001" ;
$variable_name = "Variable 11" ;
$variable_datatype = "1" ;
$variable_type = "3" ;
$format = array ();
$format [ "alignment" ] = "left" ;
$values_1 = array ( "11" , "12" );
$email_ids_1 = array ( "user+1@zohotest.com" , "user+2@zohotest.com" );
$dataset_1 = array ();
$dataset_1 [ "values" ] = $values_1 ;
$dataset_1 [ "emailIds" ] = $email_ids_1 ;
$values_2 = array ( "13" , "14" );
$email_ids_2 = array ( "user+3@zohotest.com" , "user+4@zohotest.com" );
$dataset_2 = array ();
$dataset_2 [ "values" ] = $values_2 ;
$dataset_2 [ "emailIds" ] = $email_ids_2 ;
$user_specific_data = array ( $dataset_1 , $dataset_2 );
$config = array ();
$config [ "format" ] = $format ;
$config [ "userSpecificData" ] = $user_specific_data ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> updateVariable ( $variable_id , $variable_name , $variable_datatype , $variable_type , $config );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> updateVariable ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def update_variable ( self , ac ):
variable_id = "1767024000004598005"
variable_name = "Variable 11"
variable_datatype = "1"
variable_type = "3"
variable_format = {}
variable_format [ "alignment" ] = "left"
values_1 = []
values_1 . append ( "11" )
values_1 . append ( "12" )
email_ids_1 = []
email_ids_1 . append ( "user+1@zoho.com" )
email_ids_1 . append ( "user+2@zoho.com" )
dataset_1 = {}
dataset_1 [ "values" ] = values_1
dataset_1 [ "emailIds" ] = email_ids_1
values_2 = []
values_2 . append ( "13" )
values_2 . append ( "14" )
email_ids_2 = []
email_ids_2 . append ( "user+3@zoho.com" )
email_ids_2 . append ( "user+4@zoho.com" )
dataset_2 = {}
dataset_2 [ "values" ] = values_2
dataset_2 [ "emailIds" ] = email_ids_2
user_specific_data = []
user_specific_data . append ( dataset_1 )
user_specific_data . append ( dataset_2 )
config = {}
config [ "format" ] = variable_format
config [ "userSpecificData" ] = user_specific_data
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . update_variable ( variable_id , variable_name , variable_datatype , variable_type , config )
print ( "success" )
try :
obj = sample ()
obj . update_variable ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var variableId = '' ;
var variableName = "Variable_1" ;
var variableDataType = 1 ;
var variableType = 3 ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var format = {};
format [ "alignment" ] = "left" ;
var values_1 = [];
values_1 . push ( "1" );
values_1 . push ( "2" );
var emailIds_1 = [];
emailIds_1 . push ( "user+1@zoho.com" );
emailIds_1 . push ( "user+2@zoho.com" );
var dataset_1 = {};
dataset_1 [ "values" ] = values_1 ;
dataset_1 [ "emailIds" ] = emailIds_1 ;
var values_2 = [];
values_2 . push ( "3" );
values_2 . push ( "4" );
var emailIds_2 = [];
emailIds_2 . push ( "user+3@zoho.com" );
emailIds_2 . push ( "user+4@zoho.com" );
var dataset_2 = {};
dataset_2 [ "values" ] = values_2 ;
dataset_2 [ "emailIds" ] = emailIds_2 ;
var userSpecificData = [];
userSpecificData . push ( dataset_1 );
userSpecificData . push ( dataset_2 );
var config = {};
config [ "format" ] = format ;
config [ "userSpecificData" ] = userSpecificData ;
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . updateVariable ( variableId , variableName , variableDataType , variableType , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
variableId = "" ;
variableName = "Variable_1" ;
variableDataType = 1 ;
variableType = 3 ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
format = Map ();
format.put ( "alignment" , "left" );
values_1 = {};
values_1.add ( "1" );
values_1.add ( "2" );
emailIds_1 = {};
emailIds_1.add ( "user+1@zoho.com" );
emailIds_1.add ( "user+2@zoho.com" );
dataset_1 = Map ();
dataset_1.put ( "values" , values_1 );
dataset_1.put ( "emailIds" , emailIds_1 );
values_2 = {};
values_2.add ( "1" );
values_2.add ( "2" );
emailIds_2 = {};
emailIds_2.add ( "user+1@zoho.com" );
emailIds_2.add ( "user+2@zoho.com" );
dataset_2 = Map ();
dataset_2.put ( "values" , values_2 );
dataset_2.put ( "emailIds" , emailIds_2 );
userSpecificData = {};
userSpecificData.add ( dataset_1 );
userSpecificData.add ( dataset_2 );
config = Map ();
config.put ( "format" , format );
config.put ( "userSpecificData" , userSpecificData );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/variables/" + variableId + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/variables/<variable-id>?CONFIG= <encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample value for CONFIG parameter:
Copy
{
"variableName":"Variable - 1",
"variableType":3,
"variableDataType":1,
"userSpecificData":[
{
"values":[
"4",
"5",
"6"
],
"emailIds":[
"user+1@zohotest.com"
]
},
{
"values":[
"1",
"2",
"3"
],
"emailIds":[
"user+2@zohotest.com"
]
}
],
"format":{
"alignment":"Left"
}
}
Sample Response:
HTTP/1.1 204 No Content
Update details of the specified variable.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/variables/<variable-id>
oauthscope: ZohoAnalytics.modeling.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
variableName*
String New name of the variable.
variableDatatype
Integer New datatype of the variable.
1 - PLAIN
4 - NUMBER
5 - POSITIVE_NUMBER
6 - DECIMAL_NUMBER
7 - CURRENCY
8 - PERCENT
variableType
Integer New type of the variable.
0 - LIST
1 - RANGE
2 - ALL_VALUES
format
JSONObject Variable format.
Refer FORMAT JSON Structure.
userSpecificData
JSONArray Array of user specfic values.
Refer USER_SPECIFIC_DATA JSON Structure.
defaultData
JSONObject Default value for the variable.
Mandatory for LIST and RANGE variable type.
Refer DEFAULT_DATA JSON Structure.
Key
Description
alignment
String
decimalPlaces
Integer -1 to 10
currencySymbol
String <CURRENCY_SYMBOL> Sample : en;US;
showNegativeSign
Boolean true / false
userLocale
Boolean true / false
thousandSeparator
Integer
0 - NONE
1 - COMMA
2 - DOT
3 - SPACE
4 - SINGLE_QUOTE
decimalSeparator
Integer
showPercent
Boolean true / false Valid only for PERCENT format type.
USER_SPECIFIC_DATA structure
Key
Description
values
JSONArray Array of valuesSample : ["Value_1","Value_2"]
emailIds
JSONArray Array of EmailIdsSample : ["user+1@zoho.com","user+2@zoho.com"]
defaultValue
String Default value for the variable. Mandatory for RANGE variable type.
minValue
String Minimum value for the variable. Mandatory for RANGE variable type.
maxValue
String Maximum value for the variable. Mandatory for RANGE variable type.
stepSize
String Incremental value for the variable. Mandatory for RANGE variable type.
domainName
String Name of the domain To add variable values to the white label domain users.
DEFAULT_DATA structure
Key
Description
values
JSONArray Array of values Sample : ["Value_1","Value_2"] Mandatory for LIST variable type.
defaultValue
String Default value for the variable. Mandatory for RANGE variable type.
minValue
String Minimum value for the variable. Mandatory for RANGE variable type.
maxValue
String Maximum value for the variable. Mandatory for RANGE variable type.
stepSize
String Incremental value for the variable. Mandatory for RANGE variable type.
Possible Error Codes
7103 ,
7301 ,
8083 ,
8504 ,
8516 ,
8518 ,
8535 ,
70323
Delete Variable
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
public void DeleteVariable ( IAnalyticsClient ac )
{
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
long variableId = 1148746000002545001 ;
workspace . DeleteVariable ( variableId );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . DeleteVariable ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func DeleteVariable ( ac ZAnalytics . Client ) {
variableid := "1767024000004592001"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . DeleteVariable ( variableid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "Success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
DeleteVariable ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . deleteVariable ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void deleteVariable ( AnalyticsClient ac ) throws Exception {
long variableId = 0 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . deleteVariable ( variableId );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function deleteVariable () {
$variable_id = "1767024000004613001" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> deleteVariable ( $variable_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> deleteVariable ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def delete_variable ( self , ac ):
variable_id = "1767024000004598005"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . delete_variable ( variable_id )
print ( "success" )
try :
obj = sample ()
obj . delete_variable ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . deleteVariable ( variableId ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
variableId = "21630000001051346" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/variables/" + variableId
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/variables/<variable-id>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample Response:
HTTP/1.1 204 No Content
Delete the specified variable.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/variables/<variable-id>
oauthscope: ZohoAnalytics.modeling.delete
Possible Error Codes
7103 ,
7301 ,
8083 ,
8518 ,
8535 ,
70329
Error codes in Modeling API
Sample Error:
HTTP/1.1 400 Bad Request
Content-Type:application/json;charset=UTF-8
{
"status" : "failure" ,
"summary" : "META_DBNAME_DUPLICATE" ,
"data" : {
"errorCode" : 7101,
"errorMessage" : "Workspace with the same name exists already. Provide an alternate name"
}
}
This section lists all possible error codes that could be sent from the Zoho Analytics server on failure of Modeling APIs. You can use this for appropriate error handling.
Error Codes
Error-Code
Reason
Solution
7101
Workspace with the same name exists already.
Provide an alternate name.
7103
The workspace id mentioned in the API does not exist.
Provide the valid workspace id.
7105
The view id mentioned in the API URL does not exist.
Check the view id in the request URL and provide a valid view id.
7107
The column is not present in the specified table.
Provide a valid column id.
7111
A Table with the name already exists in the Workspace.
Provide an alternate name.
7128
The column with the same name is already exists in the table.
Provide an alternate name.
7138
The view id mentioned in the API URL does not exist.
Check the view id in the request URL and provide a valid view id.
7144
Mentioned folder is not present in the Workspace.
Check if the mentioned folder is available.
7159
The column to be deleted is used in Reports, Formula Columns, Query Tables, etc.
The column with dependent views cannot be deleted. Please delete the dependent views and formula columns associated with this column before calling the delete column API.
7161
The specified table in this API is a system table (created for Service Integration).
Adding columns into system table is not allowed. You could only add columns in a non-system table using this API.
7165
The Workspace specified is a system Workspace (dedicated Workspace created for other Zoho Service integrations) which cannot be deleted.
The system Workspace cannot be deleted.
7277
The specified view holds dependent views.
Set deleteDependentViews as true to delete the dependent views.
8023
You do not have required permission to perform this operation.
Kindly contact our support team.
8024
Copy Workspace operation not allowed.
Check the Workspace key provided in the API request.
8025
Invalid custom domain.
Provide a valid domain name.
8504
The required parameter is not proper or has not been sent.
Send the parameter with valid data.
8506
The mentioned parameter has been sent more than the required count.
Check and remove that extra parameter mentioned in the response.
8516
Invalid value passed in the mentioned parameter.
Provide the valid data to the mentioned parameter.
8518
Invalid authentication.
Provide a valid OAuth token for API authentication.
8534
Invalid JSON data.
Provide a valid JSON data.
8535
Invalid oauthtoken.
Provide a valid OAuth token.
15000
A table which is needed to copy the specified report is missing in the destination workspace.
Check the destination workspace and create the missing tables.
15001
A column which is needed to copy the specified report is missing in the destination workspace.
Check the destination workspace and create the column before copying the report.
15002
A formula column which is needed to copy the specified report is missing in the destination workspace.
Check the destination workspace and create the formula column before copying the report.
15005
The report name specified already exists in the destination workspace.
Check whether the report with the same name exists in the destination workspace. Try renaming the source report or the report in destination workspace and invoke the API again.
15007
Insufficient privileges to copy the report.
Check whether the copy workspace Key is valid.
15009
The formula column name specified already exists in the destination workspace.
Check whether the formula column is already copied, otherwise, try renaming the formula column in the source table or in the destination workspace and invoke the API again.
15010
The Formula Column name specified in the API request is not present in the source table.
Check the formula column name(s) specified in the request.
15012
The reports specified in the API request is not present in the source workspace.
Check the reports specified in the request are correct and are available.
15018
The table to be copied have more than two hundred thousand rows.
Set copyHugeData as true.
70323
Variable with the same name exists already.
Provide an alternate name.
70329
The variable id mentioned in the API does not exist.
Provide a valid variable id.
In case of any error other than the above said, mail the API request URL parameters and error response details to support@zohoanalytics.com . Zoho Analytics Team will get back to you with the best possible solution.
Metadata APIs are used to fetch information about the reporting Workspaces, tables, reports, and dashboards created in Zoho Analytics.
Get Organizations
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
public void GetOrgs ( IAnalyticsClient ac )
{
List < Dictionary < string , object >> orgs = ac . GetOrgs ();
Console . WriteLine ( orgs );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetOrgs ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
)
func GetOrgs ( ac ZAnalytics . Client ) {
result , exception := ac . GetOrgs ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetOrgs ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getOrgs ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getOrgs ( AnalyticsClient ac ) throws Exception {
JSONArray result = ac . getOrgs ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getOrgs () {
$response = $this -> ac -> getOrgs ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getOrgs ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_orgs ( self , ac ):
result = ac . get_orgs ()
print ( result )
try :
obj = sample ()
obj . get_orgs ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
ac . getOrgs (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/orgs"
type : GET
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/orgs
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get organizations" ,
"data" : {
"orgs" : [
{
"orgId" : "671712892" ,
"orgName" : "bruce.wn" ,
"orgDesc" : "" ,
"createdBy" : "bruce.wn@zoho.com" ,
"createdByZuId" : "671546307" ,
"planName" : "Premium" ,
"isDefault" : true ,
"numberOfworkspaces" : 27,
"role" : "Account Admin"
} ,
{
"orgId" : "647668523" ,
"orgName" : "clark.nt" ,
"orgDesc" : "" ,
"createdBy" : "clark.nt@zoho.com" ,
"createdByZuId" : "647310528" ,
"planName" : "Premium" ,
"isDefault" : false ,
"numberOfworkspaces" : 2,
"role" : "User"
}
]
}
}
Returns list of all accessible organizations.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/orgs
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
8518 ,
8535
Get All Workspaces
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
public void GetWorkspaces ( IAnalyticsClient ac )
{
Dictionary < string , List < Dictionary < string , object >>> workspaces = ac . GetWorkspaces ();
Console . WriteLine ( workspaces );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetWorkspaces ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
)
func GetWorkspaces ( ac ZAnalytics . Client ) {
result , exception := ac . GetWorkspaces ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetWorkspaces ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getWorkspaces ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getWorkspaces ( AnalyticsClient ac ) throws Exception {
JSONObject result = ac . getWorkspaces ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getWorkspaces () {
$response = $this -> ac -> getWorkspaces ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getWorkspaces ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_workspaces ( self , ac ):
result = ac . get_workspaces ()
print ( result )
try :
obj = sample ()
obj . get_workspaces ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
ac . getWorkspaces (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces"
type : GET
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get all workspaces" ,
"data" : {
"ownedWorkspaces" : [
{
"workspaceId" : "1767024000000060001" ,
"workspaceName" : "Zoho CRM Reports" ,
"workspaceDesc" : "" ,
"orgId" : "671712892" ,
"createdTime" : "1548914379156" ,
"createdBy" : "bruce.wn@zoho.com" ,
"isDefault" : false
} ,
{
"workspaceId" : "1767024000000004900" ,
"workspaceName" : "Zoho Sales reports" ,
"workspaceDesc" : "" ,
"orgId" : "671712892" ,
"createdTime" : "1533642916942" ,
"createdBy" : "bruce.wn@zoho.com" ,
"isDefault" : false
}
] ,
"sharedWorkspaces" : [
{
"workspaceId" : "1038728000004459012" ,
"workspaceName" : "Sales Data" ,
"workspaceDesc" : "" ,
"orgId" : "67510920" ,
"createdTime" : "1614961625207" ,
"createdBy" : "clark.nt@zoho.com" ,
"isDefault" : false
}
]
}
}
Returns list of all accessible workspaces.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7925 ,
8518 ,
8535
Get Owned Workspaces
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
public void GetOwnedWorkspaces ( IAnalyticsClient ac )
{
List < Dictionary < string , object >> workspaces = ac . GetOwnedWorkspaces ();
Console . WriteLine ( workspaces );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetOwnedWorkspaces ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
)
func GetOwnedWorkspaces ( ac ZAnalytics . Client ) {
result , exception := ac . GetOwnedWorkspaces ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetOwnedWorkspaces ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getOwnedWorkspaces ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getOwnedWorkspaces ( AnalyticsClient ac ) throws Exception {
JSONArray result = ac . getOwnedWorkspaces ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getOwnedWorkspaces () {
$response = $this -> ac -> getOwnedWorkspaces ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getOwnedWorkspaces ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_owned_workspaces ( self , ac ):
result = ac . get_owned_workspaces ()
print ( result )
try :
obj = sample ()
obj . get_owned_workspaces ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
ac . getOwnedWorkspaces (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/owned"
type : GET
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/owned
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get owned workspaces" ,
"data" : {
"workspaces" : [
{
"workspaceId" : "1767024000000060001" ,
"workspaceName" : "Zoho CRM Reports" ,
"workspaceDesc" : "" ,
"orgId" : "671712892" ,
"createdTime" : "1548914379156" ,
"createdBy" : "bruce.wn@zoho.com" ,
"isDefault" : false
} ,
{
"workspaceId" : "1767024000000004900" ,
"workspaceName" : "Zoho Sales reports" ,
"workspaceDesc" : "" ,
"orgId" : "671712892" ,
"createdTime" : "1533642916942" ,
"createdBy" : "bruce.wn@zoho.com" ,
"isDefault" : false
}
]
}
}
Returns list of owned workspaces.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/owned
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7301 ,
7925 ,
8518 ,
8535
Get Shared Workspaces
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
public void GetSharedWorkspaces ( IAnalyticsClient ac )
{
List < Dictionary < string , object >> workspaces = ac . GetSharedWorkspaces ();
Console . WriteLine ( workspaces );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetSharedWorkspaces ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
)
func GetSharedWorkspaces ( ac ZAnalytics . Client ) {
result , exception := ac . GetSharedWorkspaces ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetSharedWorkspaces ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getSharedWorkspaces ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getSharedWorkspaces ( AnalyticsClient ac ) throws Exception {
JSONArray result = ac . getSharedWorkspaces ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getSharedWorkspaces () {
$response = $this -> ac -> getSharedWorkspaces ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getSharedWorkspaces ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_shared_workspaces ( self , ac ):
result = ac . get_shared_workspaces ()
print ( result )
try :
obj = sample ()
obj . get_shared_workspaces ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
ac . getSharedWorkspaces (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/shared"
type : GET
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/shared
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get shared workspaces" ,
"data" : {
"workspaces" : [
{
"workspaceId" : "1038728000004459012" ,
"workspaceName" : "Sales Data" ,
"workspaceDesc" : "" ,
"orgId" : "67510920" ,
"createdTime" : "1614961625207" ,
"createdBy" : "clark.nt@zoho.com" ,
"isDefault" : false
}
]
}
}
Returns list of shared workspaces.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/shared
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7925 ,
8518 ,
8535
Get Views
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetViews ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
List < Dictionary < string , object >> views = ws . GetViews ( null );
Console . WriteLine ( views );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetViews ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetViews ( ac ZAnalytics . Client ) {
var config map [ string ] interface {}
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetViews ( config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetViews ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getViews ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getViews ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray result = workspace . getViews ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getViews () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getViews ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getViews ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_views ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_views ()
print ( result )
try :
obj = sample ()
obj . get_views ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getViews ( config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get views" ,
"data" : {
"views" : [
{
"viewId" : "1767024000003145011" ,
"viewName" : "Accounts" ,
"viewDesc" : "Description" ,
"viewType" : "Table" ,
"parentViewId" : "" ,
"folderId" : "null" ,
"createdTime" : "1623743876529" ,
"createdBy" : "bruce.wn@zoho.com" ,
"lastModifiedTime" : "1623746630294" ,
"lastModifiedBy" : "bruce.wn@zoho.com" ,
"isFavorite" : false ,
"sharedBy" : ""
} ,
{
"viewId" : "1767024000003145052" ,
"viewName" : "Sales" ,
"viewDesc" : "" ,
"viewType" : "Table" ,
"parentViewId" : "" ,
"folderId" : "null" ,
"createdTime" : "1623745056012" ,
"createdBy" : "bruce.wn@zoho.com" ,
"lastModifiedTime" : "1623746622469" ,
"lastModifiedBy" : "bruce.wn@zoho.com" ,
"isFavorite" : false ,
"sharedBy" : ""
}
]
}
}
Returns list of all accessible views for the specified workspace.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7301 ,
7387 ,
8083 ,
8518 ,
8535
Get Folders
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetFolders ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
List < Dictionary < string , object >> folders = ws . GetFolders ();
Console . WriteLine ( folders );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetFolders ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetFolders ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetFolders ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetFolders ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getFolders ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getFolders ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray result = workspace . getFolders ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getFolders () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getFolders ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getFolders ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_folders ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_folders ()
print ( result )
try :
obj = sample ()
obj . get_folders ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getFolders (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/folders"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/folders
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get folders" ,
"data" : {
"folders" : [
{
"folderId" : "1767024000003145004" ,
"folderName" : "Tables & Reports" ,
"folderDesc" : "" ,
"folderIndex" : 1,
"isDefault" : true ,
"parentFolderId" : "-1"
} ,
{
"folderId" : "1767024000003145066" ,
"folderName" : "Account Details" ,
"folderDesc" : "" ,
"folderIndex" : 2,
"isDefault" : false ,
"parentFolderId" : "-1"
}
]
}
}
Returns list of all accessible folders for the specified workspace.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/folders
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7301 ,
7387 ,
8083 ,
8518 ,
8535
Get Recent Views
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
public void GetRecentViews ( IAnalyticsClient ac )
{
List < Dictionary < string , object >> views = ac . GetRecentViews ();
Console . WriteLine ( views );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetRecentViews ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
)
func GetRecentViews ( ac ZAnalytics . Client ) {
result , exception := ac . GetRecentViews ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetRecentViews ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getRecentViews ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getRecentViews ( AnalyticsClient ac ) throws Exception {
JSONArray result = ac . getRecentViews ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getRecentViews () {
$response = $this -> ac -> getRecentViews ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getRecentViews ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_recent_views ( self , ac ):
result = ac . get_recent_views ()
print ( result )
try :
obj = sample ()
obj . get_recent_views ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
ac . getRecentViews (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/recentviews"
type : GET
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/recentviews
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get recent views" ,
"data" : {
"views" : [
{
"viewId" : "1767024000003145011" ,
"viewName" : "Accounts" ,
"viewType" : "Table" ,
"workspaceId" : "1767024000003145002" ,
"workspaceName" : "Zoho CRM Reports" ,
"viewLastAccessedTime" : "1623746630303"
} ,
{
"viewId" : "1767024000003145052" ,
"viewName" : "Sales" ,
"viewType" : "Table" ,
"workspaceId" : "1767024000003145002" ,
"workspaceName" : "Zoho CRM Reports" ,
"viewLastAccessedTime" : "1623746622479"
}
]
}
}
Returns list of recently accessed views.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/recentviews
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7925 ,
8518 ,
8535
Get Dashboards
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
public void GetDashboards ( IAnalyticsClient ac )
{
Dictionary < string , List < Dictionary < string , object >>> dashboards = ac . GetDashboards ();
Console . WriteLine ( dashboards );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetDashboards ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
)
func GetDashboars ( ac ZAnalytics . Client ) {
result , exception := ac . GetDashboars ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetDashboars ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getDashboards ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getDashboards ( AnalyticsClient ac ) throws Exception {
JSONObject result = ac . getDashboards ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getDashboards () {
$response = $this -> ac -> getDashboards ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getDashboards ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_dashboards ( self , ac ):
result = ac . get_dashboards ()
print ( result )
try :
obj = sample ()
obj . get_dashboards ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
ac . getDashboards (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/dashboards"
type : GET
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/dashboards
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get all dashboards" ,
"data" : {
"ownedViews" : [
{
"viewId" : "1767024000000060095" ,
"viewName" : "Closed Revenue" ,
"viewDesc" : "Dashboard capturing the highlights of closed revenue" ,
"viewType" : "Dashboard" ,
"parentViewId" : "" ,
"folderId" : "1767024000000060002" ,
"createdTime" : "1548914379158" ,
"createdBy" : "bruce.wn@zoho.com" ,
"lastModifiedTime" : "1548914399837" ,
"lastModifiedBy" : "bruce.wn@zoho.com" ,
"isFavorite" : false ,
"sharedBy" : "" ,
"workspaceId" : "1767024000000060001" ,
"orgId" : "671712892"
}
] ,
"sharedViews" : [
{
"viewId" : "1770174000000672854" ,
"viewName" : "Sales VS Cost Dashboard" ,
"viewDesc" : "Comparison between Sales and Cost" ,
"viewType" : "Dashboard" ,
"parentViewId" : "" ,
"folderId" : "1770174000000674175" ,
"createdTime" : "1553245755646" ,
"createdBy" : "clark.nt@zoho.com" ,
"lastModifiedTime" : "1554441829143" ,
"lastModifiedBy" : "clark.nt@zoho.com" ,
"isFavorite" : false ,
"sharedBy" : "" ,
"workspaceId" : "1770174000000670320" ,
"orgId" : "671711195"
}
]
}
}
Returns list of all accessible dashboards.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/dashboards
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7925 ,
8518 ,
8535
Get Owned Dashboards
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
public void GetOwnedDashboards ( IAnalyticsClient ac )
{
List < Dictionary < string , object >> dashboards = ac . GetOwnedDashboards ();
Console . WriteLine ( dashboards );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetOwnedDashboards ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
)
func GetOwnedDashboars ( ac ZAnalytics . Client ) {
result , exception := ac . GetOwnedDashboars ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetOwnedDashboars ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getOwnedDashboards ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getOwnedDashboards ( AnalyticsClient ac ) throws Exception {
JSONArray result = ac . getOwnedDashboards ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getOwnedDashboards () {
$response = $this -> ac -> getOwnedDashboards ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getOwnedDashboards ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_owned_dashboards ( self , ac ):
result = ac . get_owned_dashboards ()
print ( result )
try :
obj = sample ()
obj . get_owned_dashboards ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
ac . getOwnedDashboards (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/dashboards/owned"
type : GET
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/dashboards/owned
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get owned dashboards" ,
"data" : {
"views" : [
{
"viewId" : "1767024000000060095" ,
"viewName" : "Closed Revenue" ,
"viewDesc" : "Dashboard capturing the highlights of closed revenue" ,
"viewType" : "Dashboard" ,
"parentViewId" : "" ,
"folderId" : "1767024000000060002" ,
"createdTime" : "1548914379158" ,
"createdBy" : "bruce.wn@zoho.com" ,
"lastModifiedTime" : "1548914399837" ,
"lastModifiedBy" : "bruce.wn@zoho.com" ,
"isFavorite" : false ,
"sharedBy" : "" ,
"workspaceId" : "1767024000000060001" ,
"orgId" : "671712892"
} ,
{
"viewId" : "1767024000000060099" ,
"viewName" : "Expected Revenue" ,
"viewDesc" : "Expected Revenue Dashboard" ,
"viewType" : "Dashboard" ,
"parentViewId" : "" ,
"folderId" : "1767024000000060002" ,
"createdTime" : "1548914379158" ,
"createdBy" : "bruce.wn@zoho.com" ,
"lastModifiedTime" : "1548914400061" ,
"lastModifiedBy" : "bruce.wn@zoho.com" ,
"isFavorite" : false ,
"sharedBy" : "" ,
"workspaceId" : "1767024000000060001" ,
"orgId" : "671712892"
}
]
}
}
Returns the list of owned dashboards.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/dashboards/owned
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7301 ,
7925 ,
8518 ,
8535
Get Shared Dashboards
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
public void GetSharedDashboards ( IAnalyticsClient ac )
{
List < Dictionary < string , object >> dashboards = ac . GetSharedDashboards ();
Console . WriteLine ( dashboards );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetSharedDashboards ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
)
func GetSharedDashboars ( ac ZAnalytics . Client ) {
result , exception := ac . GetSharedDashboars ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetSharedDashboars ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getSharedDashboards ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getSharedDashboards ( AnalyticsClient ac ) throws Exception {
JSONArray result = ac . getSharedDashboards ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getSharedDashboards () {
$response = $this -> ac -> getSharedDashboards ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getSharedDashboards ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_shared_dashboards ( self , ac ):
result = ac . get_shared_dashboards ()
print ( result )
try :
obj = sample ()
obj . get_shared_dashboards ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
ac . getSharedDashboards (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/dashboards/shared"
type : GET
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/dashboards/shared
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get shared dashboards" ,
"data" : {
"views" : [
{
"viewId" : "1770174000000672854" ,
"viewName" : "Sales VS Cost Dashboard" ,
"viewDesc" : "Comparison between Sales and Cost" ,
"viewType" : "Dashboard" ,
"parentViewId" : "" ,
"folderId" : "1770174000000674175" ,
"createdTime" : "1553245755646" ,
"createdBy" : "clark.nt@zoho.com" ,
"lastModifiedTime" : "1554441829143" ,
"lastModifiedBy" : "clark.nt@zoho.com" ,
"isFavorite" : false ,
"sharedBy" : "" ,
"workspaceId" : "1770174000000670320" ,
"orgId" : "671711195"
}
]
}
}
Returns list of shared dashboards.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/dashboards/shared
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7925 ,
8518 ,
8535
Get Workspace Secretkey
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetWorkspaceSecretKey ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
string result = ws . GetSecretKey ( null );
Console . WriteLine ( result );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetWorkspaceSecretKey ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetWorkspaceSecretKey ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetSecretKey ( config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetWorkspaceSecretKey ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getWorkspaceSecretKey ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getWorkspaceSecretKey ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
String result = workspace . getSecretKey ( null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getWorkspaceSecretKey () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getSecretKey ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getWorkspaceSecretKey ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_workspace_secret_key ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_secret_key ()
print ( result )
try :
obj = sample ()
obj . get_workspace_secret_key ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getSecretKey ( config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/secretkey"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/secretkey
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get workspace secretkey" ,
"data" : {
"workspaceKey" : "dc0543fc624210a5e4f578adabe07369"
}
}
Returns the secret key of the specified workspace.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/secretkey
oauthscope: ZohoAnalytics.metadata.read
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
regenerateKey
Boolean To create the new secret key. (NOTE:The old key will be disabled.)
Possible Error Codes
7301 ,
7387 ,
8083 ,
8518 ,
8535
Get Workspace Details
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long workspaceId = 35130000001055707 ;
public void GetWorkspaceDetails ( IAnalyticsClient ac )
{
Dictionary < string , object > workspaceInfo = ac . GetWorkspaceDetails ( workspaceId );
Console . WriteLine ( workspaceInfo );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetWorkspaceDetails ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
workspaceId = "35130000001055707"
)
func GetWorkspaceDetails ( ac ZAnalytics . Client ) {
result , exception := ac . GetWorkspaceDetails ( workspaceId )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetWorkspaceDetails ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getWorkspaceDetails ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getWorkspaceDetails ( AnalyticsClient ac ) throws Exception {
JSONObject result = ac . getWorkspaceDetails ( workspaceId );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getWorkspaceDetails () {
$response = $this -> ac -> getWorkspaceDetails ( $this -> workspace_id );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getWorkspaceDetails ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_workspace_details ( self , ac ):
result = ac . get_workspace_details ( Config . WORKSPACEID )
print ( result )
try :
obj = sample ()
obj . get_workspace_details ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
ac . getWorkspaceDetails ( workspaceId ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
workspaceId = "35130000001055707" ;
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId
type : GET
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get workspace details" ,
"data" : {
"workspaces" : {
"workspaceId" : "1767024000003145002" ,
"workspaceName" : "Account Details" ,
"workspaceDesc" : "" ,
"createdTime" : "1623743494151" ,
"createdBy" : "bruce.wn@zoho.com" ,
"orgId" : "671712892"
}
}
}
Returns details of the specified workspace.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7301 ,
7103 ,
8518 ,
8535
Get View Details
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long viewId = 35730000007354002 ;
public void GetViewDetails ( IAnalyticsClient ac )
{
Dictionary < string , object > viewInfo = ac . GetViewDetails ( viewId , null );
Console . WriteLine ( viewInfo );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetViewDetails ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
viewId = "35730000007354002"
)
func GetViewDetails ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
result , exception := ac . GetViewDetails ( viewId , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetViewDetails ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getViewDetails ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getViewDetails ( AnalyticsClient ac ) throws Exception {
JSONObject result = ac . getViewDetails ( viewId , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getViewDetails () {
$response = $this -> ac -> getViewDetails ( $this -> view_id );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getViewDetails ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_view_details ( self , ac ):
result = ac . get_view_details ( Config . VIEWID )
print ( result )
try :
obj = sample ()
obj . get_view_details ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
ac . getViewDetails ( viewId , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
viewId = "35730000007354002" ;
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/views/" + viewId
type : GET
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/views/<view-id>
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get view details" ,
"data" : {
"views" : {
"viewId" : "1767024000003145011" ,
"viewName" : "Accounts" ,
"viewDesc" : "Description" ,
"viewType" : "Table" ,
"workspaceId" : "1767024000003145002" ,
"orgId" : "671712892"
}
}
}
Returns details of the specified view.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/views/<view-id>
oauthscope: ZohoAnalytics.metadata.read
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
withInvolvedMetaInfo
Boolean To include the column details/involved views details of the specific view.
Possible Error Codes
7301 ,
7104 ,
8518 ,
8535
Add Favorite Workspace
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void AddFavoriteWorkspace ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . AddFavorite ();
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AddFavoriteWorkspace ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func AddFavoriteWorkspace ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . AddFavorite ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AddFavoriteWorkspace ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . addFavoriteWorkspace ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void addFavoriteWorkspace ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . addFavorite ();
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function addFavoriteWorkspace () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> addFavorite ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> addFavoriteWorkspace ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def add_favorite_workspace ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . add_favorite ()
print ( "success" )
try :
obj = sample ()
obj . add_favorite_workspace ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . addFavorite (). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/favorite"
type : POST
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/favorite
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Adds a specified workspace as favorite.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/favorite
oauthscope: ZohoAnalytics.metadata.update
Possible Error Codes
7103 ,
7301 ,
7387 ,
8083 ,
8518 ,
8535
Remove Favorite Workspace
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void RemoveFavoriteWorkspace ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . RemoveFavorite ();
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RemoveFavoriteWorkspace ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func RemoveFavoriteWorkspace ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . RemoveFavorite ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RemoveFavoriteWorkspace ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . removeFavoriteWorkspace ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void removeFavoriteWorkspace ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . removeFavorite ();
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function removeFavoriteWorkspace () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> removeFavorite ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> removeFavoriteWorkspace ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def remove_favorite_workspace ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . remove_favorite ()
print ( "success" )
try :
obj = sample ()
obj . remove_favorite_workspace ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . removeFavorite (). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/favorite"
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/favorite
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Remove a specified workspace from favorite.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/favorite
oauthscope: ZohoAnalytics.metadata.update
Possible Error Codes
7103 ,
7301 ,
7387 ,
8083 ,
8518 ,
8535
Add Favorite View
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void AddFavoriteView ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . AddFavorite ();
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AddFavoriteView ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func AddFavoriteView ( ac ZAnalytics . Client ) {
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . AddFavorite ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AddFavoriteView ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . addFavoriteView ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void addFavoriteView ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . addFavorite ();
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function addFavoriteView () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> addFavorite ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> addFavoriteView ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def add_favorite_view ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . add_favorite ()
print ( "success" )
try :
obj = sample ()
obj . add_favorite_view ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . addFavorite (). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35130000001332092" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/favorite"
type : POST
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/favorite
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Adds a specified view as favorite.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/favorite
oauthscope: ZohoAnalytics.metadata.update
Possible Error Codes
7104 ,
7301 ,
7387 ,
8083 ,
8518 ,
8535
Remove Favorite View
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void RemoveFavoriteView ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . RemoveFavorite ();
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RemoveFavoriteView ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func RemoveFavoriteView ( ac ZAnalytics . Client ) {
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . RemoveFavorite ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RemoveFavoriteView ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . removeFavoriteView ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void removeFavoriteView ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . removeFavorite ();
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function removeFavoriteView () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> removeFavorite ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> removeFavoriteView ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def remove_favorite_view ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . remove_favorite ()
print ( "success" )
try :
obj = sample ()
obj . remove_favorite_view ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . removeFavorite (). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35130000001332092" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/favorite"
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/favorite
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Remove a specified view from favorite.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/favorite
oauthscope: ZohoAnalytics.metadata.update
Possible Error Codes
7104 ,
7301 ,
7387 ,
8083 ,
8518 ,
8535
Add Default Workspace
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void AddDefaultWorkspace ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . AddDefault ();
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AddDefaultWorkspace ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func AddDefaultWorkspace ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . AddDefault ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AddDefaultWorkspace ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . addDefaultWorkspace ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void addDefaultWorkspace ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . addDefault ();
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function addDefaultWorkspace () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> addDefault ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> addDefaultWorkspace ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def add_default_workspace ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . add_default ()
print ( "success" )
try :
obj = sample ()
obj . add_default_workspace ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . addDefault (). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/default"
type : POST
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/default
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Adds a specified workspace as default.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/default
oauthscope: ZohoAnalytics.metadata.update
Possible Error Codes
7103 ,
7301 ,
7387 ,
8083 ,
8518 ,
8535
Remove Default Workspace
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void RemoveDefaultWorkspace ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . RemoveDefault ();
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RemoveDefaultWorkspace ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func RemoveDefaultWorkspace ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . RemoveDefault ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RemoveDefaultWorkspace ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . removeDefaultWorkspace ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void removeDefaultWorkspace ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . removeDefault ();
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function removeDefaultWorkspace () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> removeDefault ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> removeDefaultWorkspace ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def remove_default_workspace ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . remove_default ()
print ( "success" )
try :
obj = sample ()
obj . remove_default_workspace ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . removeDefault (). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/default"
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/default
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Remove a specified workspace from default.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/default
oauthscope: ZohoAnalytics.metadata.update
Possible Error Codes
7103 ,
7301 ,
7387 ,
8083 ,
8518 ,
8535
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
public void GetMetaDetails ( IAnalyticsClient ac )
{
string workspaceName = "API Lib" ;
string viewName = "Sales" ;
IOrgAPI org = ac . GetOrgInstance ( orgId );
Dictionary < string , Dictionary < string , object >> metaDetails = org . GetMetaDetails ( workspaceName , viewName );
Console . WriteLine ( metaDetails );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetMetaDetails ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func GetMetaDetails ( ac ZAnalytics . Client ) {
workspaceName := "Workspace"
org := ZAnalytics . GetOrgInstance ( & ac , orgId )
result , exception := org . GetMetaDetails ( workspaceName , "" )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetMetaDetails ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getMetaDetails ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getMetaDetails ( AnalyticsClient ac ) throws Exception {
OrgAPI org = ac . getOrgInstance ( orgId );
String workspaceName = "API Lib" ;
String viewName = "Sales" ;
JSONObject result = org . getMetaDetails ( workspaceName , viewName );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getMetaDetails () {
$workspace_name = "PHP Lib workspace - 1" ;
$org = $this -> ac -> getOrgInstance ( $this -> org_id );
$response = $org -> getMetaDetails ( $workspace_name , NULL );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getMetaDetails ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_meta_details ( self , ac ):
workspace_name = "API Lib" ;
view_name = "Sales"
org = ac . get_org_instance ( Config . ORGID )
result = org . get_meta_details ( workspace_name , view_name )
print ( result )
try :
obj = sample ()
obj . get_meta_details ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceName = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var org = ac . getOrgInstance ( orgId );
org . getMetaDetails ( workspaceName ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceName = "Workspace" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
config = Map ();
config.put ( "workspaceName" , workspaceName );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/metadetails"
type : GET
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/metadetails?CONFIG=<encoded_json_value>
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"workspaceName": "<workspace-name>"
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get meta details" ,
"data" : {
"workspaces" : {
"workspaceId" : "1767024000003145002" ,
"workspaceName" : "Account details" ,
"workspaceDesc" : "" ,
"orgId" : "671712892"
}
}
}
Returns details of the specified workspace/view.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/metadetails
oauthscope: ZohoAnalytics.metadata.read
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
workspaceName*
String The name of the workspace.
viewName
String The name of the view.
Possible Error Codes
7103 ,
7104 ,
7301 ,
8083 ,
8504 ,
8518 ,
8535
Get Datasources
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
public void GetDatasources ( IAnalyticsClient ac )
{
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
List < Dictionary < string , object >> datasources = workspace . GetDatasources ();
Console . WriteLine ( datasources );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetDatasources ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetDatasources ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetDatasources ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetDatasources ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getDatasources ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getDatasources ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray result = workspace . getDatasources ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getDatasources () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getDatasources ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getDatasources ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_datasources ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_datasources ()
print ( result )
try :
obj = sample ()
obj . get_datasources ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getDatasources (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/datasources"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/datasources
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset= UTF-8
{
"status" :"success" ,
"summary" :"Fetch Datasources" ,
"data" :{
"dataSources" :[
{
"datasourceName" :"Zoho Books" ,
"datasourceId" :"7617000004356057" ,
"source" :"AnalyticsTest" ,
"lastDataSyncStatus" :"Data Sync Successful" ,
"lastDataSyncTime" :"18 January, 2022 12:30:05 PM GMT" ,
"schedule" :"Daily at 12:30 hrs GMT" ,
"nextScheduleTime" :"19 January, 2022 12:30:00 PM GMT" ,
"syncUsed" :"0" ,
"totalSyncAllowed" :"5"
} ,
{
"datasourceName" :"LinkedIn Ads" ,
"datasourceId" :"7617000005026296" ,
"source" :"Ad Account_test" ,
"lastDataSyncStatus" :"Data Sync Successful" ,
"lastDataSyncTime" :"18 January, 2022 10:52:00 PM IST" ,
"schedule" :"Every 3 Hours" ,
"nextScheduleTime" :"18 January, 2022 06:38:33 PM GMT" ,
"syncUsed" :"1" ,
"totalSyncAllowed" :"5"
}
]
}
}
Returns list of datasources for the specified workspace.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/datasources
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7103 ,
7301 ,
7387 ,
8518 ,
8535
Sync Data
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
public void SyncData ( IAnalyticsClient ac )
{
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
long datasourceId = 1148746000002545001 ;
workspace . SyncData ( datasourceId , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . SyncData ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func SyncData ( ac ZAnalytics . Client ) {
datasourceid := "1767024000004595194"
config := map [ string ] interface {}{}
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . SyncData ( datasourceid , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "Success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
SyncData ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . syncData ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void syncData ( AnalyticsClient ac ) throws Exception {
long datasourceId = 0 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . syncData ( datasourceId , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function syncData () {
$datasource_id = "1767024000004595194" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> syncData ( $datasource_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> syncData ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def sync_data ( self , ac ):
datasource_id = "1767024000004595194"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . sync_data ( datasource_id )
print ( "success" )
try :
obj = sample ()
obj . sync_data ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var datasoureId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . syncData ( datasoureId ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
datasoureId = "" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/datasources/" + datasoureId + "/sync"
type : POST
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/datasources/<datasource-id>/sync
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample Response:
HTTP/1.1 204 No Content
Initiate data sync for the specified datasource.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/datasources/<datasource-id>/sync
oauthscope: ZohoAnalytics.metadata.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
userName
String Datasource credential - username
password
String Datasource credential - password
Possible Error Codes
7103 ,
7301 ,
8083 ,
8518 ,
8535 ,
18061
Refetch Data
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
long viewId = 31670000001055909 ;
public void RefetchData ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
view . RefetchData ( null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RefetchData ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "31670000001055909"
)
func RefetchData ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
exception := view . RefetchData ( config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "Success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RefetchData ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 31670000001055909 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . refetchData ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void refetchData ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . refetchData ( null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "31670000001055909" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function refetchData () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$view -> refetchData ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> refetchData ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "31670000001055909" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def refetch_data ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
view . refetch_data ()
print ( "success" )
try :
obj = sample ()
obj . refetch_data ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '31670000001055909' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . refetchData (). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "31670000001055909" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/sync"
type : POST
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/sync
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample Response:
HTTP/1.1 204 No Content
Sync data from available datasource for the specified view.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/sync
oauthscope: ZohoAnalytics.metadata.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
userName
String Datasource credential - username
password
String Datasource credential - password
Possible Error Codes
7103 ,
7104 ,
7301 ,
8083 ,
8518 ,
8535
Get Last Import Details
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
long viewId = 31670000001055909 ;
public void GetLastImportDetails ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
Dictionary < string , object > importDetails = view . GetLastImportDetails ();
Console . WriteLine ( importDetails );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetLastImportDetails ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "31670000001055909"
)
func GetLastImportDetails ( ac ZAnalytics . Client ) {
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , exception := view . GetLastImportDetails ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetLastImportDetails ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 31670000001055909 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getLastImportDetails ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getLastImportDetails ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
JSONObject result = view . getLastImportDetails ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "31670000001055909" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getLastImportDetails () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> getLastImportDetails ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getLastImportDetails ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "31670000001055909" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_last_import_details ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . get_last_import_details ()
print ( result )
try :
obj = sample ()
obj . get_last_import_details ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '31670000001055909' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . getLastImportDetails (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "31670000001055909" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/importdetails"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/importdetails
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset= UTF-8
{
"status" :"success" ,
"summary" :"Fetch last import details" ,
"data" :{
"viewName" :"SampleSales" ,
"lastImportTime" :"18 October, 2021 11:02:41 AM GMT" ,
"lastImportStatus" :"Success" ,
"columns" :{
"total" :"7" ,
"success" :"7"
} ,
"rows" :{
"total" :"755" ,
"success" :"755" ,
"warning" :"0" ,
"failed" :"0"
} ,
"importErrors" :""
}
}
Returns last import details of the specified view.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/importdetails
oauthscope: ZohoAnalytics.metadata.read
Possible Error Codes
7103 ,
7104 ,
7301 ,
8083 ,
8518 ,
8535
Update Datasource Connection
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 67648404 ;
long workspaceId = 1148746000002449012 ;
public void UpdateDatasourceConnection ( IAnalyticsClient ac )
{
long datasourceId = 1148746000002545001 ;
Dictionary < string , object > config = new Dictionary < string , object >();
config . Add ( "serviceName" , "AMAZON RDS" );
config . Add ( "databaseType" , "POSTGRESQL" );
config . Add ( "hostName" , "******" );
config . Add ( "port" , "5432" );
config . Add ( "userName" , "******" );
config . Add ( "password" , "******" );
config . Add ( "cloudDatabaseName" , "sampledb" );
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
workspace . UpdateDatasourceConnection ( datasourceId , config );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "" ;
string clientSecret = "" ;
string refreshToken = "" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . UpdateDatasourceConnection ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func UpdateDatasourceConnection ( ac ZAnalytics . Client ) {
datasourceid := "1767024000003890005"
config := map [ string ] interface {}{}
config [ "serviceName" ] = "AMAZON RDS"
config [ "databaseType" ] = "MYSQL"
config [ "hostName" ] = "******"
config [ "port" ] = "3306"
config [ "userName" ] = "******"
config [ "password" ] = "*****"
config [ "cloudDatabaseName" ] = "sampledb"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . UpdateDatasourceConnection ( datasourceid , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "Success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
UpdateDatasourceConnection ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . updateDatasourceConnection ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void updateDatasourceConnection ( AnalyticsClient ac ) throws Exception {
long datasourceId = 0 l ;
JSONObject config = new JSONObject ();
config . put ( "serviceName" , "AMAZON RDS" );
config . put ( "databaseType" , "POSTGRESQL" );
config . put ( "hostName" , "******" );
config . put ( "port" , "5432" );
config . put ( "userName" , "******" );
config . put ( "password" , "******" );
config . put ( "cloudDatabaseName" , "sampledb" );
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . updateDatasourceConnection ( datasourceId , config );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function updateDatasourceConnection () {
$datasource_id = "1767024000003890005" ;
$config = array ();
$config [ "serviceName" ] = "AMAZON RDS" ;
$config [ "databaseType" ] = "MYSQL" ;
$config [ "hostName" ] = "******" ;
$config [ "port" ] = "3306" ;
$config [ "userName" ] = "******" ;
$config [ "password" ] = "******" ;
$config [ "cloudDatabaseName" ] = "sampledb" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> updateDatasourceConnection ( $datasource_id , $config );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> updateDatasourceConnection ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def update_datasource_connection ( self , ac ):
datasource_id = "1767024000003890005"
config = {}
config [ "serviceName" ] = "AMAZON RDS"
config [ "databaseType" ] = "POSTGRESQL"
config [ "hostName" ] = "******"
config [ "port" ] = "5432"
config [ "userName" ] = "******"
config [ "password" ] = "******"
config [ "cloudDatabaseName" ] = "sampledb"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . update_datasource_connection ( datasource_id , config )
print ( "success" )
try :
obj = sample ()
obj . update_datasource_connection ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var nodelib = require ( './ZAnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var datasoureId = '' ;
var config = {};
config [ "serviceName" ] = "AMAZON RDS" ;
config [ "databaseType" ] = "POSTGRESQL" ;
config [ "hostName" ] = "******" ;
config [ "port" ] = "5432" ;
config [ "userName" ] = "******" ;
config [ "password" ] = "******" ;
config [ "cloudDatabaseName" ] = "sampledb" ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . updateDatasourceConnection ( datasoureId , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
datasoureId = "" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
config = Map ();
config.put ( "serviceName" , "AMAZON RDS" );
config.put ( "databaseType" , "POSTGRESQL" );
config.put ( "hostName" , "******" );
config.put ( "port" , "5432" );
config.put ( "userName" , "******" );
config.put ( "password" , "******" );
config.put ( "cloudDatabaseName" , "sampledb" );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/datasources/" + datasoureId + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/datasources/<datasoure-id>?CONFIG= <encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id>'
-H 'Authorization: Zoho-oauthtoken <access_token>'
Sample value for CONFIG parameter:
Copy
{
"serviceName":"AMAZON RDS",
"databaseType":"POSTGRESQL",
"hostName":"******",
"port":"5432",
"userName":"******",
"password":"******",
"cloudDatabaseName":"sampledb"
}
Sample Response:
HTTP/1.1 204 No Content
Update connection details for the specified datasource.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/datasources/<datasource-id>
oauthscope: ZohoAnalytics.metadata.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
serviceName* String Name of the cloud service.Allowed Values:
AMAZON RDS AMAZON REDSHIFT MICROSOFT AZURE GOOGLE CLOUD SQL HEROKU POSTGRESQL LOCAL DATABASE SNOWFLAKE AMAZON ATHENA GOOGLE BIG QUERY PANOPLY RACKSPACE CLOUD IBM CLOUD ORACLE CLOUD OTHER CLOUD SERVICES
databaseType String Type of the database.Allowed Values:
MYSQL SQLSERVER ORACLE POSTGRESQL MARIADB AMAZON AURORA MYSQL PERVASIVE SYBASE AMAZON ATHENA SQL DATABASE SQL DATA WAREHOUSE MEMSQL DB2 AMAZON AURORA POSTGRESQL EXASOL VERTICA AMAZON VECTOR GREENPLUM DENODO JDBC CONNECTION
hostName* String
For AMAZON ATHENA service - provide the AWS Region value.
For SNOWFLAKE service - provide full name of your account as in snowflake.
For all other services - provide the service endpoint (or) hostname, used to identifiy the cloud database instance. This can be obtained from the management console provided by the respective cloud database services.
port Integer Database port number.
userName* String Service provider login username.
password String Service provider login password.
cloudDatabaseName String Specify the database name as in the cloud service.
instanceName String For SQLSERVER datatype - provide the instance name on which your database is present. If not specified, then default instance will be taken to establish connection.
s3OutputLocation String For AMAZON ATHENA service - provide the Amazon s3 location path where you want to store the query results. This path should be prefixed bt s3://.
warehouseName String For SNOWFLAKE service - provide the warehousename value on which your snowflake database instance is present. Make sure that the provided warehouse is active and the given user has permission to access the database.
sId String For ORACLE service - provide the oracle service name value.
projectId String For GOOGLE BIG QUERY service - provide the project id of your BigQuery project. This can be obtained from the dashboard of your Google Cloud console.
refreshToken String For GOOGLE BIG QUERY service - provide the refresh token value.
accessToken String For GOOGLE BIG QUERY service - provide the access token value.
useSSL Boolean Set true if your database server set up to serve encrypted data through SSL. Default false.
Possible Error Codes
7103 ,
7301 ,
8083 ,
8504 ,
8518 ,
8535 ,
18011 ,
18040 ,
18041 ,
18042 ,
18043 ,
18044 ,
18056 ,
18060 ,
18061
Enable Domain Workspace
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void EnableDomainAccess ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . EnableDomainAccess ();
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . EnableDomainAccess ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func EnableDomainAccess ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . EnableDomainAccess ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
EnableDomainAccess ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . enableDomainAccess ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void enableDomainAccess ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . enableDomainAccess ();
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function enableDomainAccess () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> enableDomainAccess ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> enableDomainAccess ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def enable_domain_access ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . enable_domain_access ()
print ( "success" )
try :
obj = sample ()
obj . enable_domain_access ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . enableDomainAccess (). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/wlaccess"
type : POST
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/wlaccess
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Enable workspace to the specified white label domain.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/wlaccess
oauthscope: ZohoAnalytics.metadata.update
Possible Error Codes
7103 ,
7301 ,
7387 ,
8083 ,
8518 ,
8535
Disable Domain Workspace
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void DisableDomainAccess ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . DisableDomainAccess ();
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . DisableDomainAccess ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func DisableDomainAccess ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . DisableDomainAccess ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
DisableDomainAccess ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . disableDomainAccess ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void disableDomainAccess ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . disableDomainAccess ();
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function disableDomainAccess () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> disableDomainAccess ();
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> disableDomainAccess ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def disable_domain_access ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . disable_domain_access ()
print ( "success" )
try :
obj = sample ()
obj . disable_domain_access ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . disableDomainAccess (). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/wlaccess"
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/wlaccess
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Disable workspace from the specified white label domain.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/wlaccess
oauthscope: ZohoAnalytics.metadata.update
Possible Error Codes
7103 ,
7301 ,
7387 ,
8083 ,
8518 ,
8535
Sample Error:
HTTP/1.1 400 Bad Request
Content-Type:application/json;charset=UTF-8
{
"status" : "failure" ,
"summary" : "META_OBJECT_NOT_PRESENT" ,
"data" : {
"errorCode" : 7103,
"errorMessage" : "Workspace not found! Please check whether the workspace exists."
}
}
This section lists all possible error codes that could be sent from the Zoho Analytics server on failure of Metadata APIs. You can use this for appropriate error handling.
Error Codes
Error-Code
Reason
Solution
7103
The workspace id mentioned in the API does not exist.
Provide the valid workspace id.
7104
The view id specified in the API does not exist.
Provide the valid view id.
7301
You (your full name) do not have the permission to do this operation.
Access as administrator or permitted user to perform the operation.
7387
Workspaces does not belongs to current organization.
Provide a valid organization and workspace id.
7925
You are not part of the analytics organization.
Create your analytics organization.
8060
Domain does not exist.
Provide a valid domain name that you have purchased from Zoho Analytics.
8078
The mentioned attribute has an empty value.
Provide a valid JSON data.
8079
The mentioned attribute is not present in the JSON configuration.
Provide a valid JSON data.
8083
Organization id is not present in the request header.
Provide a valid organization id in the request header.
8504
The required parameter is not proper or has not been sent.
Send the parameter with valid data.
8518
Invalid authentication.
Provide a valid OAuth token for API authentication.
8535
Invalid oauthtoken.
Provide a valid OAuth token.
18011
Cannot connect to specified Endpoint. Please check the specified Endpoint is correct and try again.
Provid a valid endpoint value for the attribute HOSTNAME.
18040
Login failed for specified user. Please check the username and password.
Check whether the username and password provided are valid for connecting the cloud service.
18041
Provided database does not exist. Please check the details provided.
Check whether the provided database exist in the cloud service.
18042
Cannot connect to the specified S3 Output Location.
Check whether the provided S3 Output Location is valid.
18043
Cannot connect to the specified region.
Check whether the provide AWS region of the Athena Database is valid.
18044
Provided Project Id does not exist or you are not authorized to access this project in Google BigQuery.
Check whether the provide Project Id is valid for connecting Google BigQuery service.
18056
Cloud connections not available for this table.
Provide a view name which has an existing cloud connection.
18060
Provided workspace do not have a live connection setup.
Specify a workspace with live connect setup.
18061
Provided datasource id not associated for the workspace.
Check whether the provided datasource id is valid and the datasource is present in the specified workspace.
In case of any error other than the above said, mail the API request URL parameters and error response details to support@zohoanalytics.com . Zoho Analytics Team will get back to you with the best possible solution.
Sharing and Collaboration API
Share APIs used to share views (reports & dashboards) with permissions to users. You can also manage view sharing as well as remove sharing through APIs.
Get Org Admins
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
public void GetOrgAdmins ( IAnalyticsClient ac )
{
IOrgAPI org = ac . GetOrgInstance ( orgId );
List < string > admins = org . GetAdmins ();
Console . WriteLine ( admins );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetOrgAdmins ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func GetOrgAdmins ( ac ZAnalytics . Client ) {
org := ZAnalytics . GetOrgInstance ( & ac , orgId )
result , exception := org . GetAdmins ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetOrgAdmins ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getOrgAdmins ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getOrgAdmins ( AnalyticsClient ac ) throws Exception {
OrgAPI org = ac . getOrgInstance ( orgId );
JSONArray result = org . getAdmins ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getOrgAdmins () {
$org = $this -> ac -> getOrgInstance ( $this -> org_id );
$response = $org -> getAdmins ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getOrgAdmins ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_org_admins ( self , ac ):
org = ac . get_org_instance ( Config . ORGID )
result = org . get_admins ()
print ( result )
try :
obj = sample ()
obj . get_org_admins ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var org = ac . getOrgInstance ( orgId );
org . getAdmins (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/orgadmins"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/orgadmins
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get org admins" ,
"data" : {
"orgAdmins" : [
"user+1@zoho.com" ,
"user+2@zoho.com"
]
}
}
HTTP/1.1 204 No Content
Returns list of admins for a specified organization.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/orgadmins
oauthscope: ZohoAnalytics.share.read
Possible Error Codes
8083 ,
8518 ,
8535
Get Workspace Admins
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetWorkspaceAdmins ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
object [] admins = ws . GetAdmins ();
Console . WriteLine ( admins );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetWorkspaceAdmins ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetWorkspaceAdmins ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetAdmins ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetWorkspaceAdmins ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getWorkspaceAdmins ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getWorkspaceAdmins ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray result = workspace . getAdmins ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getWorkspaceAdmins () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getAdmins ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getWorkspaceAdmins ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_workspace_admins ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_admins ()
print ( result )
try :
obj = sample ()
obj . get_workspace_admins ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getAdmins (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/admins"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/admins
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get workspace admins" ,
"data" : {
"workspaceAdmins" : [
{
"adminMembers" : [
"user+1@zoho.com" ,
"user+2@zoho.com"
]
}
]
}
}
Returns list of admins for the specified workspace.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/admins
oauthscope: ZohoAnalytics.share.read
Possible Error Codes
7301 ,
7387 ,
8083 ,
8518 ,
8535
Add Workspace Admins
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void AddWorkspaceAdmins ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
List < string > emailIds = new List < string >();
emailIds . Add ( "testuser+1@zoho.com" );
ws . AddAdmins ( emailIds , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AddWorkspaceAdmins ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func AddWorkspaceAdmins ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
emailids := [ 1 ] string {}
emailids [ 0 ] = "user+1@zoho.com"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . AddAdmins ( emailids , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AddWorkspaceAdmins ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . addWorkspaceAdmins ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void addWorkspaceAdmins ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "user+1@zoho.com" );
workspace . addAdmins ( emailIds , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function addWorkspaceAdmins () {
$email_ids = array ( "user+1@zoho.com" );
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> addAdmins ( $email_ids );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> addWorkspaceAdmins ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def add_workspace_admins ( self , ac ):
email_ids = []
email_ids . append ( "user+1@zoho.com" )
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . add_admins ( email_ids )
print ( "success" )
try :
obj = sample ()
obj . add_workspace_admins ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var emailIds = [];
emailIds . push ( '' );
emailIds . push ( '' );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . addAdmins ( emailIds , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
config = Map ();
config.put ( "emailIds" , emailIds );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/admins"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/admins?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"]
}
Sample Response:
HTTP/1.1 204 No Content
Add admins for the specified workspace.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/admins
oauthscope: ZohoAnalytics.share.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the admin users to be added.Sample: ["emailId1","emailId2"]
domainName
String Name of the domain. To add users to the white label domain.
Possible Error Codes
7103 ,
7301 ,
7387 ,
8078 ,
8079 ,
8083 ,
8504 ,
8518 ,
8535
Remove Workspace Admins
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void RemoveWorkspaceAdmins ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
List < string > emailIds = new List < string >();
emailIds . Add ( "testuser+1@zoho.com" );
ws . RemoveAdmins ( emailIds , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RemoveWorkspaceAdmins ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func RemoveWorkspaceAdmins ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
emailids := [ 1 ] string {}
emailids [ 0 ] = "user+1@zoho.com"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . RemoveAdmins ( emailids , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RemoveWorkspaceAdmins ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . removeWorkspaceAdmins ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void removeWorkspaceAdmins ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "user+1@zoho.com" );
workspace . removeAdmins ( emailIds , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function removeWorkspaceAdmins () {
$email_ids = array ( "user+1@zoho.com" );
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> removeAdmins ( $email_ids );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> removeWorkspaceAdmins ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def remove_workspace_admins ( self , ac ):
email_ids = []
email_ids . append ( "user+1@zoho.com" )
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . remove_admins ( email_ids )
print ( "success" )
try :
obj = sample ()
obj . remove_workspace_admins ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var emailIds = [];
emailIds . push ( '' );
emailIds . push ( '' );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . removeAdmins ( emailIds , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
config = Map ();
config.put ( "emailIds" , emailIds );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/admins"
type : DELETE
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/admins?CONFIG=<encoded_json_value>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"]
}
Sample Response:
HTTP/1.1 204 No Content
Remove admins from the specified workspace.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/admins
oauthscope: ZohoAnalytics.share.delete
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the admin users to be removed.Sample: ["emailId1","emailId2"]
domainName
String Name of domain. To remove users from the white label domain.
Possible Error Codes
7103 ,
7301 ,
7387 ,
8078 ,
8079 ,
8083 ,
8504 ,
8518 ,
8535
Get Workspace Shared Details
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetWorkspaceShareInfo ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
Dictionary < string , object > shareInfo = ws . GetShareInfo ();
Console . WriteLine ( shareInfo );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetWorkspaceShareInfo ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetShareInfo ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , err := workspace . GetShareInfo ()
if ( err != nil ){
fmt . Println ( "Error - " + err . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetShareInfo ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getWorkspaceShareInfo ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getWorkspaceShareInfo ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
ShareInfo result = workspace . getShareInfo ();
System . out . println ( result . getSharedUsers ());
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getWorkspaceShareInfo () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getShareInfo ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getWorkspaceShareInfo ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_workspace_share_info ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_share_info ()
print ( result )
try :
obj = sample ()
obj . get_workspace_share_info ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getShareInfo (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/share"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/share
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get share info" ,
"data" : {
"userShareInfo" : [
{
"emailId" : "user+1@zoho.com" ,
"views" : [
{
"viewId" : "1767024000003145011" ,
"viewName" : "Accounts" ,
"sharedBy" : "bruce.wn@zoho.com" ,
"permissions" : {
"read" : true ,
"export" : false ,
"vud" : false ,
"addRow" : false ,
"updateRow" : false ,
"deleteRow" : false ,
"deleteAllRows" : false ,
"importAppend" : false ,
"importAddOrUpdate" : false ,
"importDeleteAllAdd" : false ,
"importDeleteUpdateAdd" : false ,
"drillDown" : false ,
"share" : false ,
"discussion" : true
}
}
]
}
] ,
"groupShareInfo" : [] ,
"publicShareInfo" : {
"emailId" : "Public Visitor" ,
"views" : [
{
"viewId" : "1767024000003145052" ,
"viewName" : "Sales" ,
"sharedBy" : "bruce.wn@zoho.com" ,
"permissions" : {
"read" : true ,
"export" : false ,
"vud" : false ,
"addRow" : false ,
"updateRow" : false ,
"deleteRow" : false ,
"deleteAllRows" : false ,
"importAppend" : false ,
"importAddOrUpdate" : false ,
"importDeleteAllAdd" : false ,
"importDeleteUpdateAdd" : false ,
"drillDown" : false ,
"share" : false ,
"discussion" : false
}
}
]
} ,
"privateLinkShareInfo" : {}
}
}
Returns shared details of the specified workspace.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/share
oauthscope: ZohoAnalytics.share.read
Possible Error Codes
7103 ,
7301 ,
7387 ,
8078 ,
8079 ,
8083 ,
8504 ,
8518 ,
8535
Share Views
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void ShareViews ( IAnalyticsClient ac )
{
List < long > viewIds = new List < long >();
viewIds . Add ( 35730000007354002 );
List < string > emailIds = new List < string >();
emailIds . Add ( "testuser+1@zoho.com" );
Dictionary < string , bool > permissions = new Dictionary < string , bool >();
permissions . Add ( "read" , true );
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . ShareViews ( viewIds , emailIds , permissions , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . ShareViews ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func ShareViews ( ac ZAnalytics . Client ) {
viewids := [ 1 ] string {}
viewids [ 0 ] = "35130000001354002"
emailids := [ 1 ] string {}
emailids [ 0 ] = "user+1@zoho.com"
permissions := map [ string ] bool {}
permissions [ "read" ] = true
config := map [ string ] interface {}{}
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
err := workspace . ShareViews ( viewids , emailids , permissions , config )
if ( err != nil ){
fmt . Println ( "Error - " + err . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
ShareViews ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . shareViews ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void shareViews ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "user+1@zoho.com" );
emailIds . put ( "user+2@zoho.com" );
JSONArray viewIds = new JSONArray ();
viewIds . put ( "35730000007354002" );
JSONObject permissions = new JSONObject ();
permissions . put ( "read" , true );
workspace . shareViews ( viewIds , emailIds , permissions , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function shareViews () {
$view_ids = array ( "35130000001353002" , "35130000001355005" );
$email_ids = array ( "user+1@zoho.com" , "user+2@zoho.com" );
$permissions = array ();
$permissions [ "read" ] = "true" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> shareViews ( $view_ids , $email_ids , $permissions );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> shareViews ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def share_views ( self , ac ):
view_ids = []
view_ids . append ( "35730000007354002" )
email_ids = []
email_ids . append ( "user+1@zoho.com" )
permissions = {}
permissions [ "read" ] = True
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . share_views ( view_ids , email_ids , permissions )
print ( "success" )
try :
obj = sample ()
obj . share_views ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewIds = [];
var emailIds = [];
var permissions = {};
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
viewIds . push ( '' );
viewIds . push ( '' );
emailIds . push ( '' );
emailIds . push ( '' );
permissions [ 'read' ] = true ;
permissions [ 'share' ] = true ;
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . shareViews ( viewIds , emailIds , permissions , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
viewIds = {};
viewIds.add ( "35130000001354002" );
viewIds.add ( "35130000001355005" );
permissions = Map ();
permissions.put ( "read" , "true" );
permissions.put ( "export" , "true" );
config = Map ();
config.put ( "emailIds" , emailIds );
config.put ( "viewIds" , viewIds );
config.put ( "permissions" , permissions );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/share"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/share?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"],
"viewIds": ["<view-id1>", "<view-id2>"],
"permissions": {
"read": "true",
"export": "true"
}
}
Sample Response:
HTTP/1.1 204 No Content
Share views to the specified users.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/share
oauthscope: ZohoAnalytics.share.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the users to whom the views need to be shared.Sample: ["emailId1","emailId2"]
viewIds*
JSONArray View ids which to be shared.Sample: ["viewId1","viewId2"]
permissions*
JSONObject Permissions JSON object (permission attributes table).Sample: {"read":true,"vud":true,"export":true}
criteria
String To apply filter criteria while sharing a view to users. The specified criteria will be applied to the reports shared, thereby filtering the data viewed, when the report is accessed by the shared user.Sample: {"criteria":"\"SalesTable\".\"Region\"='East'"} Refer this link for more details about how to construct a criteria.
inheritParentFilterCriteria
Boolean This is valid only for reports(not tables). If true, then its parent tables’ criteria is also taken into account while sharing.
inviteMail
Boolean To send the invitation mail to the provided email addresses.
inviteMailCCMe
Boolean to CC the invitation mail to you on sharing.
mailSubject
String Invitation mail subject.
mailMessage
String Invitation mail messasge.
domainName
String Name of domian. To to share views to the white label domain.
Permission Attributes
Key
Description
read*
Boolean Permission to access the view. Should be true.
export
Boolean Permission to export the view data. Default value - false.
vud
Boolean Permission to view the underlying data. Default value - false.
drillDown
Boolean Permission to drill down in a chart. Default value - false.
addRow
Boolean Permission to add a row in the table. Default value - false.
updateRow
Boolean Permission to update a row in the table. Default value - false.
deleteRow
Boolean Permission to delete a row in the table. Default value - false.
deleteAllRows
Boolean Permission to delete all rows in the table. Default value - false.
importAppend
Boolean Permission to import data into the table using APPEND option. Default value - false.
importAddOrUpdate
Boolean Permission to import data into the table using UPDATEADD option. Default value - false.
importDeleteAllAdd
Boolean Permission to import data into the table using the TRUNCATEADD option. Default value - false.
share
Boolean Permission to share the view to other users. Default value - false.
discussion
Boolean Permission to allow commenting in the view. Default value - false.
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
8060 ,
8078 ,
8079 ,
8083 ,
8504 ,
8518 ,
8535
Remove Share
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void RemoveShare ( IAnalyticsClient ac )
{
List < long > viewIds = new List < long >();
viewIds . Add ( 35730000007354002 );
List < string > emailIds = new List < string >();
emailIds . Add ( "testuser+1@zoho.com" );
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . RemoveShare ( viewIds , emailIds , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RemoveShare ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func RemoveShare ( ac ZAnalytics . Client ) {
viewids := [ 1 ] string {}
viewids [ 0 ] = "35130000001354002"
emailids := [ 1 ] string {}
emailids [ 0 ] = "user+1@zoho.com"
config := map [ string ] interface {}{}
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
err := workspace . RemoveShare ( viewids , emailids , config )
if ( err != nil ){
fmt . Println ( "Error - " + err . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RemoveShare ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . removeShare ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void removeShare ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "user+2@zoho.com" );
JSONArray viewIds = new JSONArray ();
viewIds . put ( "35730000007354002" );
workspace . removeShare ( viewIds , emailIds , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function removeShare () {
$view_ids = array ( "35130000001080001" , "35130000001080082" );
$email_ids = array ( "user+1@zoho.com" , "user+2@zoho.com" );
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> removeShare ( $view_ids , $email_ids );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> removeShare ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def remove_share ( self , ac ):
view_ids = []
view_ids . append ( "35730000007354002" )
email_ids = []
email_ids . append ( "user+1@zoho.com" )
permissions = {}
permissions [ "read" ] = True
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . remove_share ( view_ids , email_ids )
print ( "success" )
try :
obj = sample ()
obj . remove_share ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewIds = [];
var emailIds = [];
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
viewIds . push ( '' );
viewIds . push ( '' );
emailIds . push ( '' );
emailIds . push ( '' );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . removeShare ( viewIds , emailIds , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
viewIds = {};
viewIds.add ( "35130000001354002" );
viewIds.add ( "35130000001355005" );
config = Map ();
config.put ( "emailIds" , emailIds );
config.put ( "viewIds" , viewIds );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/share"
type : DELETE
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/share?CONFIG=<encoded_json_value>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"],
"removeAllViews": "true"
}
Sample Response:
HTTP/1.1 204 No Content
Remove shared views for the specified users.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/share
oauthscope: ZohoAnalytics.share.delete
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the users to whom the sharing need to be removed.Sample: ["emailId1", "emailId2"]
viewIds
JSONArray View ids whose sharing needs to be removed.Sample: ["viewId1", "viewId2"]
removeAllViews
Boolean To remove all the shared views for the specified users.
domainName
String Name of the domain. To remove the shared views from the white label domain.
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
8060 ,
8078 ,
8079 ,
8083 ,
8504 ,
8518 ,
8535
Get My Permissions
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void GetMyPermissions ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
Dictionary < string , bool > permissions = view . GetMyPermissions ();
Console . WriteLine ( permissions );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetMyPermissions ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func GetMyPermissions ( ac ZAnalytics . Client ) {
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , exception := view . GetMyPermissions ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetMyPermissions ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getMyPermissions ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getMyPermissions ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
JSONObject result = view . getMyPermissions ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getMyPermissions () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> getMyPermissions ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getMyPermissions ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_my_permissions ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . get_my_permissions ()
print ( result )
try :
obj = sample ()
obj . get_my_permissions ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . getMyPermissions (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/share/mypermissions"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/share/mypermissions
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get user permissions" ,
"data" : {
"permissions" : {
"read" : true ,
"export" : true ,
"vud" : true ,
"addRow" : true ,
"updateRow" : true ,
"deleteRow" : true ,
"deleteAllRows" : true ,
"importAppend" : true ,
"importAddOrUpdate" : true ,
"importDeleteAllAdd" : true ,
"importDeleteUpdateAdd" : true ,
"drillDown" : true ,
"share" : true ,
"discussion" : true
}
}
}
Returns permissions for the specified view.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/share/mypermissions
oauthscope: ZohoAnalytics.share.read
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
8083 ,
8504 ,
8518 ,
8535
Get Groups
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetGroups ( IAnalyticsClient ac )
{
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
List < Dictionary < string , object >> groups = ws . GetGroups ();
Console . WriteLine ( groups );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetGroups ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetGroups ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetGroups ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetGroups ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getGroups ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getGroups ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray result = workspace . getGroups ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getGroups () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getGroups ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getGroups ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_groups ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_groups ()
print ( result )
try :
obj = sample ()
obj . get_groups ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getGroups (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/groups"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/groups
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get groups" ,
"data" : {
"groups" : [
{
"groupName" : "Group-1" ,
"groupId" : "1767024000003150004" ,
"groupDesc" : "" ,
"groupMembers" : [
"user+1@zoho.com" ,
"bruce.wn@zoho.com"
]
} ,
{
"groupName" : "Group-2" ,
"groupId" : "1767024000003150006" ,
"groupDesc" : "" ,
"groupMembers" : [
"bruce.wn@zoho.com"
]
}
]
}
}
Returns list of groups for the specified workspace.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/groups
oauthscope: ZohoAnalytics.share.read
Possible Error Codes
7103 ,
7301 ,
7338 ,
7387 ,
8083 ,
8504 ,
8518 ,
8535
Get Group Details
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetGroupDetails ( IAnalyticsClient ac )
{
long groupId = 2348746000002449002 ;
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
Dictionary < string , object > info = ws . GetGroupDetails ( groupId );
Console . WriteLine ( info );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetGroupDetails ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetGroupDetails ( ac ZAnalytics . Client ) {
groupid := "35130000001408001"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetGroupDetails ( groupid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetGroupDetails ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getGroupDetails ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getGroupDetails ( AnalyticsClient ac ) throws Exception {
long groupId = 1148746000002541001 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONObject result = workspace . getGroupDetails ( groupId );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getGroupDetails () {
$group_id = "35130000001364001" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getGroupDetails ( $group_id );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getGroupDetails ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_group_details ( self , ac ):
group_id = "1148746000002588001"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_group_details ( group_id )
print ( result )
try :
obj = sample ()
obj . get_group_details ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var groupId = '35130000001364001' ;
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getGroupDetails ( groupId ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
groupId = "35130000001376005" ;
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/groups/" + groupId
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/groups/<group-id>
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get group details" ,
"data" : {
"groups" : {
"groupName" : "Group-1" ,
"groupId" : "1767024000003150004" ,
"groupDesc" : "" ,
"groupMembers" : [
"user+1@zoho.com" ,
"bruce.wn@zoho.com"
]
}
}
}
Returns details of the specified group.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/groups/<group-id>
oauthscope: ZohoAnalytics.share.read
Possible Error Codes
7103 ,
7301 ,
7338 ,
7387 ,
8083 ,
8504 ,
8518 ,
8535
Create Group
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void CreateGroup ( IAnalyticsClient ac )
{
string groupName = "API" ;
List < string > emailIds = new List < string >();
emailIds . Add ( "testuser+1@zoho.com" );
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
long groupId = ws . CreateGroup ( groupName , emailIds , null );
Console . WriteLine ( groupId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CreateGroup ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func CreateGroup ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
emailids := [ 1 ] string {}
emailids [ 0 ] = "user+1@zoho.com"
var groupname = "API Group"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . CreateGroup ( groupname , emailids , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CreateGroup ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . createGroup ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void createGroup ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
String groupName = "API Group" ;
JSONArray emailIds = new JSONArray ();
emailIds . put ( "user+1@zoho.com" );
String result = workspace . createGroup ( groupName , emailIds , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function createGroup () {
$group_name = "Sample Group 1" ;
$group_members = array ( "user+1@zoho.com" );
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> createGroup ( $group_name , $group_members );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> createGroup ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def create_group ( self , ac ):
group_name = "Grp 1"
email_ids = []
email_ids . append ( "user+1@zoho.com" )
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . create_group ( group_name , email_ids )
print ( result )
try :
obj = sample ()
obj . create_group ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var groupName = '' ;
var emailIds = [];
var config = {};
emailIds . push ( '' );
emailIds . push ( '' );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . createGroup ( groupName , emailIds , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
groupName = "ZAGroup - 1" ;
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
config = Map ();
config.put ( "groupName" , groupName );
config.put ( "emailIds" , emailIds );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/groups"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/groups?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"groupName": "<group-name>",
"emailIds": ["<email-id1>", "<email-id2>"]
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create group" ,
"data" : {
"groupId" : "1767024000003145069"
}
}
Create a group in the specified workspace.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/groups
oauthscope: ZohoAnalytics.share.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
groupName*
String Name of the group.
groupDesc
String Description of the group.
emailIds*
JSONArray The email address of the users to be added to the group.Sample: ["emailId1", "emailId2"]
inviteMail
Boolean To send the invitation mail to the provided email addresses.
mailSubject
String Invitation mail subject.
mailMessage
String Invitation mail messasge.
domainName
String Name of the domain To map the created group to the specified domain.
Possible Error Codes
7103 ,
7282 ,
7301 ,
7338 ,
7387 ,
8060 ,
8078 ,
8079 ,
8083 ,
8504 ,
8518 ,
8535
Rename Group
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void RenameGroup ( IAnalyticsClient ac )
{
long groupId = 1148746000002556001 ;
string groupName = "Renamed API" ;
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . RenameGroup ( groupId , groupName , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RenameGroup ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func RenameGroup ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
groupid := "1148746000002506003"
var groupname = "Renamed API Group"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . RenameGroup ( groupid , groupname , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RenameGroup ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . renameGroup ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void renameGroup ( AnalyticsClient ac ) throws Exception {
long groupId = 1148746000002541001 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
String groupName = "Renamed API Group" ;
workspace . renameGroup ( groupId , groupName , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function renameGroup () {
$group_id = "35130000001364001" ;
$new_group_name = "Renamed Group 1" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> renameGroup ( $group_id , $new_group_name );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> renameGroup ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def rename_group ( self , ac ):
group_id = "35130000001364002"
group_name = "Renamed Grp 1"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . rename_group ( group_id , group_name )
print ( "success" )
try :
obj = sample ()
obj . rename_group ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var groupId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var newGroupName = '' ;
var config = {};
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . renameGroup ( groupId , newGroupName , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
groupId = "35130000001376005" ;
groupName = "New Group Name" ;
config = Map ();
config.put ( "groupName" , groupName );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/groups/" + groupId + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/groups/<group-id>?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"groupName": "<group-name>"
}
Sample Response:
HTTP/1.1 204 No Content
Rename a specified group.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/groups/<group-id>
oauthscope: ZohoAnalytics.share.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
groupName*
String New name for the group.
groupDesc
String New description for the group.
Possible Error Codes
7103 ,
7282 ,
7301 ,
7338 ,
7387 ,
8078 ,
8079 ,
8083 ,
8504 ,
8518 ,
8535
Add Group Members
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void AddGroupMembers ( IAnalyticsClient ac )
{
long groupId = 1148746000002556001 ;
List < string > emailIds = new List < string >();
emailIds . Add ( "testuser+2@zoho.com" );
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . AddGroupMembers ( groupId , emailIds , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AddGroupMembers ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func AddGroupMembers ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
emailids := [ 1 ] string {}
emailids [ 0 ] = "sampleuser+2@zoho.com"
groupid := "1148746000002506005"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . AddGroupMembers ( groupid , emailids , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AddGroupMembers ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . addGroupMembers ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void addGroupMembers ( AnalyticsClient ac ) throws Exception {
long groupId = 1148746000002541001 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "testuser+2@zoho.com" );
workspace . addGroupMembers ( groupId , emailIds , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function addGroupMembers () {
$group_id = "35130000001364001" ;
$group_members = array ( "testuser+2@zoho.com" );
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> addGroupMembers ( $group_id , $group_members );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> addGroupMembers ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def add_group_members ( self , ac ):
group_id = "1148746000002588001"
email_ids = []
email_ids . append ( "sampleuser+2@zoho.com" )
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . add_group_members ( group_id , email_ids )
print ( "success" )
try :
obj = sample ()
obj . add_group_members ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var groupId = '' ;
var emailIds = [];
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
emailIds . push ( '' );
emailIds . push ( '' );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . addGroupMembers ( groupId , emailIds , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
groupId = "35130000001376005" ;
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
config = Map ();
config.put ( "emailIds" , emailIds );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/groups/" + groupId + "/members"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/groups/<group-id>/members?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"]
}
Sample Response:
HTTP/1.1 204 No Content
Add users to the specified group.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/groups/<group-id>/members
oauthscope: ZohoAnalytics.share.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the users to be added to the group.Sample: ["emailId1", "emailId2"]
inviteMail
Boolean To send the invitation mail to the provided email addresses.
mailSubject
String Invitation mail subject.
mailMessage
String Invitation mail messasge.
Possible Error Codes
7103 ,
7301 ,
7387 ,
8078 ,
8079 ,
8083 ,
8504 ,
8518 ,
8535
Remove Group Members
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void RemoveGroupMembers ( IAnalyticsClient ac )
{
long groupId = 1148746000002556001 ;
List < string > emailIds = new List < string >();
emailIds . Add ( "testuser+2@zoho.com" );
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . RemoveGroupMembers ( groupId , emailIds , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RemoveGroupMembers ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func RemoveGroupMembers ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
emailids := [ 1 ] string {}
emailids [ 0 ] = "sampleuser+2@zoho.com"
groupid := "1148746000002506005"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . RemoveGroupMembers ( groupid , emailids , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RemoveGroupMembers ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . removeGroupMembers ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void removeGroupMembers ( AnalyticsClient ac ) throws Exception {
long groupId = 1148746000002541001 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "testuser+2@zoho.com" );
workspace . removeGroupMembers ( groupId , emailIds , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function removeGroupMembers () {
$group_id = "35130000001364001" ;
$group_members = array ( "testuser+2@zoho.com" );
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> removeGroupMembers ( $group_id , $group_members );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> removeGroupMembers ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def remove_group_members ( self , ac ):
group_id = "1148746000002588001"
email_ids = []
email_ids . append ( "sampleuser+2@zoho.com" )
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . remove_group_members ( group_id , email_ids )
print ( "success" )
try :
obj = sample ()
obj . remove_group_members ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var groupId = '' ;
var emailIds = [];
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
emailIds . push ( '' );
emailIds . push ( '' );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . removeGroupMembers ( groupId , emailIds , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
groupId = "35130000001376005" ;
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
config = Map ();
config.put ( "emailIds" , emailIds );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/groups/" + groupId + "/members"
type : DELETE
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/groups/<group-id>/members?CONFIG=<encoded_json_value>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"]
}
Sample Response:
HTTP/1.1 204 No Content
Remove users from the specified group.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/groups/<group-id>/members
oauthscope: ZohoAnalytics.share.delete
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the users to be removed from the group.Sample: ["emailId1", "emailId2"]
notifyUser
Boolean To send the notification mail to the provided email addresses.
Possible Error Codes
7103 ,
7301 ,
7387 ,
8078 ,
8079 ,
8083 ,
8504 ,
8518 ,
8535
Delete Group
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void DeleteGroup ( IAnalyticsClient ac )
{
long groupId = 1148746000002556001 ;
IWorkspaceAPI ws = ac . GetWorkspaceInstance ( orgId , workspaceId );
ws . DeleteGroup ( groupId );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . DeleteGroup ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func DeleteGroup ( ac ZAnalytics . Client ) {
groupid := "1148746000002506005"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . DeleteGroup ( groupid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
DeleteGroup ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . deleteGroup ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void deleteGroup ( AnalyticsClient ac ) throws Exception {
long groupId = 1148746000002541001 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . deleteGroup ( groupId );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function deleteGroup () {
$group_id = "35130000001364001" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> deleteGroup ( $group_id );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> deleteGroup ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def delete_group ( self , ac ):
group_id = "1148746000002588001"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . delete_group ( group_id )
print ( "success" )
try :
obj = sample ()
obj . delete_group ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var groupId = '' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . deleteGroup ( groupId ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
groupId = "35130000001376005" ;
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/groups/" + groupId
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/groups/<group-id>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Delete a specified group.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/groups/<group-id>
oauthscope: ZohoAnalytics.share.delete
Possible Error Codes
7103 ,
7301 ,
7387 ,
8078 ,
8079 ,
8083 ,
8504 ,
8518 ,
8535
Error codes in Sharing API
Sample Error:
HTTP/1.1 400 Bad Request
Content-Type:application/json;charset=UTF-8
{
"status" : "failure" ,
"summary" : "META_OBJECT_NOT_PRESENT" ,
"data" : {
"errorCode" : 7103,
"errorMessage" : "Workspace not found! Please check whether the workspace exists."
}
}
This section lists all possible error codes that could be sent from the Zoho Analytics server on failure of Sharing APIs. You can use this for appropriate error handling.
Error Codes
Error-Code
Reason
Solution
6028
User is in inactive state.
Change user status to active.
7003
Required parameters are missing in the request.
Send all the required parameters related to that particular action.
7103
The workspace id mentioned in the API does not exist.
Provide the valid workspace id.
7104
The view id specified in the API does not exist.
Provide the valid view id.
7105
View name specified in the Workspace does not exist.
Provide a valid view name.
7106
View id not present in the Workspace.
Provide a valid view id.
7282
Group name already exist.
Provide a different group name.
7301
You (your full name) do not have the permission to do this operation.
Access as administrator or permitted user to perform the operation.
7338
Group does not belongs to current workspace.
Provide a valid group id.
7387
Workspaces does not belongs to current organization.
Provide a valid organization and workspace id.
8026
Permission configuration missing.
Atleast any one of the following permission is required: [read, export, vud, drillDown, addRow, updateRow, deleteRow, deleteAllRows, importAppend, importAddOrUpdate, importDeleteAllAdd, share, discussion].
8027
Mentioned workspace/view is not found.
Provide a valid workspace/view name.
8060
Domain does not exist.
Provide a valid domain name that you have purchased from Zoho Analytics.
8078
The mentioned attribute has an empty value.
Provide a valid JSON data.
8079
The mentioned attribute is not present in the JSON configuration.
Provide a valid JSON data.
8083
Organization id is not present in the request header.
Provide a valid organization id in the request header.
8504
The required parameter is not proper or has not been sent.
Send the parameter with valid data.
8518
Invalid authentication.
Provide a valid OAuth token for API authentication.
8535
Invalid oauthtoken.
Provide a valid OAuth token.
In case you encounter any other errors, please mail the API request URL parameters and error response details to support@zohoanalytics.com . Zoho Analytics Team will get back to you shortly with the best possible solution.
Embed API
Embed APIs are used to embed reports, dashboards created in Zoho Analytics into your Web pages/applications programmatically. It also offers possibilities to developers for creating dynamic reporting content embedded within their websites and applications seamlessly.
Get View URL
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void GetViewUrl ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
string viewUrl = view . GetViewURL ( null );
Console . WriteLine ( viewUrl );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetViewUrl ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func GetViewUrl ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , exception := view . GetViewUrl ( config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetViewUrl ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getViewURL ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getViewURL ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
String result = view . getViewURL ( null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getViewURL () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> getViewURL ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getViewURL ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_view_url ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . get_view_url ()
print ( result )
try :
obj = sample ()
obj . get_view_url ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . getViewUrl ( config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/publish"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/publish
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get view url" ,
"data" : {
"viewUrl" : "https://analyticsapi.zoho.com/open-view/1767024000003145011?ZDB_THEME_NAME=blue"
}
}
Returns the URL to access the specified view.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/publish
oauthscope: ZohoAnalytics.embed.read
Query Parameters
Parameter Name
Description
CONFIG
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
criteria
String If criteria is sent, then the rows matching the criteria alone are visible, else all the rows are visible.Sample: {"criteria":"\"SalesTable\".\"Region\"='East'"} Refer this link for more details about how to construct a criteria.
includeTitle
Boolean To display the view name in the embedded mode. Default value - true.
includeDesc
Boolean To display the view description in the embedded mode. Default value - true.
includeToolBar
Boolean To include the toolbar in the embedded mode. Default value - false.
includeSearchBox
Boolean To include the search box in the table. Default value - false.
includeDatatypeSymbol
Boolean To include the datatype symbol in the table column. Default value - false.
legendPosition
String Controls to display the position on the legend.RIGHT LEFT TOPLEFT TOPRIGHT TOPCENTER BOTTOMLEFT BOTTOMRIGHT BOTTOMCENTER NONE
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
8083 ,
8518 ,
8535
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void GetEmbedUrl ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
string viewUrl = view . GetEmbedURL ( null );
Console . WriteLine ( viewUrl );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetEmbedUrl ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func GetEmbedUrl ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , exception := view . GetEmbedUrl ( config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetEmbedUrl ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getEmbedURL ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getEmbedURL ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
String result = view . getEmbedURL ( null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getEmbedURL () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> getEmbedURL ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getEmbedURL ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_embed_url ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . get_embed_url ()
print ( result )
try :
obj = sample ()
obj . get_embed_url ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . getEmbedUrl ( config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/publish/embed"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/publish/embed
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get embed url" ,
"data" : {
"embedUrl" : "https://analyticsapi.zoho.com/open-view/1767024000003145011?ZDB_THEME_NAME=blue&FS=OS&NEW_ENCRYPTION=true&RSCONFIG=2d91fa85daeb3d27387880153d16f3c6a8ed4301aa9abfed9e4ac83ca3f1d89da971986afb68149365831e6f619752c7d75bd0489f017feb75ca54d06f835a7ebe4981c3ffa5d656a25dd84e2b5a37e2"
}
}
Returns embed URL to access the specified view. The generated URL is a short-living URL, which adds more security to the URL. This URL does not require a login and is controlled by the permissions based on the configurations.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/publish/embed
oauthscope: ZohoAnalytics.embed.read
Query Parameters
Parameter Name
Description
CONFIG
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
criteria
String If criteria is sent, then the rows matching the criteria alone are visible, else all the rows are visible.Sample: {"criteria":"\"SalesTable\".\"Region\"='East'"} Refer this link for more details about how to construct a criteria.
includeTitle
Boolean To display the view name in the embedded mode. Default value - true.
includeDesc
Boolean To display the view description in the embedded mode. Default value - true.
includeToolBar
Boolean To include the toolbar in the embedded mode. Default value - false.
includeSearchBox
Boolean To include the search box in the table. Default value - false.
includeDatatypeSymbol
Boolean To include the datatype symbol in the table column. Default value - false.
legendPosition
String Controls to display the position on the legend.RIGHT LEFT TOPLEFT TOPRIGHT TOPCENTER BOTTOMLEFT BOTTOMRIGHT BOTTOMCENTER NONE
validityPeriod
Integer Controls the validity period(in seconds) of the generated URL. Default value - 3600 seconds(One hour).
permissions
JSONObject Permissions JSON object (permission attributes table).Sample: {"vud":true,"export":true}
vudColumns
Array of JSONObject To limit the view underlying data option to specified columns from specified tables. This will be valid only if the vud permission is set to true.Sample: [{"tableName":"table1","columnNames":["column1","column2"]}]
drillColumns
Array of JSONObject To limit the drill down option to specified columns from specified tables. This will be valid only if the drillDown permission is set to true.Sample: [{"tableName":"table1","columnNames":["column1","column2"]}]
language
String To specify language for the embed view. Default value - englishenglish chinese japanese french italian spanish portuguese portuguese_td german chinese_td dutch russian polish arabic turkish hungarian hebrew swedish korean danish ukranian vietnamies bulgarian croatian czech hindi thai indonesian malay
Permission Attributes
Key
Description
export
Boolean Permission to export the data. Default value - false.
vud
Boolean Permission to view the Underlying data. Default value - false.
drillDown
Boolean Permission to drill down in a Chart. Default value - false.
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
7395 ,
8083 ,
8518 ,
8535
Get Private URL
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void GetPrivateURL ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
string viewUrl = view . GetPrivateURL ( null );
Console . WriteLine ( viewUrl );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetPrivateURL ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func GetPrivateUrl ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , exception := view . GetPrivateUrl ( config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetPrivateUrl ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getPrivateURL ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getPrivateURL ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
String result = view . getPrivateURL ( null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getPrivateURL () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> getPrivateURL ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getPrivateURL ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_private_url ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . get_private_url ()
print ( result )
try :
obj = sample ()
obj . get_private_url ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . getPrivateUrl ( config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/publish/privatelink"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/publish/privatelink
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get private url" ,
"data" : {
"privateUrl" : "https://analyticsapi.zoho.com/open-view/1767024000003145011/eee1191ea88d52e486aaecf5f748dc56"
}
}
Returns private URL to access the specified view.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/publish/privatelink
oauthscope: ZohoAnalytics.embed.read
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
7395 ,
8083 ,
8518 ,
8535
Create Private URL
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
long viewId = 35730000007354002 ;
public void CreatePrivateURL ( IAnalyticsClient ac )
{
IViewAPI view = ac . GetViewInstance ( orgId , workspaceId , viewId );
string viewUrl = view . CreatePrivateURL ( null );
Console . WriteLine ( viewUrl );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CreatePrivateURL ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
viewId = "35730000007354002"
)
func CreatePrivateUrl ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
view := ZAnalytics . GetViewInstance ( & ac , orgId , workspaceId , viewId )
result , exception := view . CreatePrivateUrl ( config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CreatePrivateUrl ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
private long viewId = 35730000007354002 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . createPrivateUrl ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void createPrivateUrl ( AnalyticsClient ac ) throws Exception {
ViewAPI view = ac . getViewInstance ( orgId , workspaceId , viewId );
String result = view . createPrivateURL ( null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
public $view_id = "35730000007354002" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function createPrivateURL () {
$view = $this -> ac -> getViewInstance ( $this -> org_id , $this -> workspace_id , $this -> view_id );
$response = $view -> createPrivateURL ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> createPrivateURL ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
VIEWID = "35730000007354002" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def create_private_url ( self , ac ):
view = ac . get_view_instance ( Config . ORGID , Config . WORKSPACEID , Config . VIEWID )
result = view . create_private_url ()
print ( result )
try :
obj = sample ()
obj . create_private_url ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var viewId = '35730000007354002' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var view = ac . getViewInstance ( orgId , workspaceId , viewId );
view . createPrivateUrl ( config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
viewId = "35730000007354002" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/views/" + viewId + "/publish/privatelink"
type : POST
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/views/<view-id>/publish/privatelink
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create private url" ,
"data" : {
"privateUrl" : "https://analyticsapi.zoho.com/open-view/1767024000003145011/eee1191ea88d52e486aaecf5f748dc56"
}
}
Create a private URL for the specified view.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/views/<view-id>/publish/privatelink
oauthscope: ZohoAnalytics.embed.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
criteria
String If criteria is sent, then the rows matching the criteria alone are visible, else all the rows are visible.Sample: {"criteria":"\"SalesTable\".\"Region\"='East'"} Refer this link for more details about how to construct a criteria.
permissions
JSONObject Permissions JSON object (permission attributes table).Sample: {"vud":true, "export":true}
regenerateKey
Boolean To generate a new privatekey, previously generated privatelink will be disabled. Default value - false.
Permission Attributes
Key
Description
export
Boolean Permission to export the data. Default value - false.
vud
Boolean Permission to view the Underlying data. Default value - false.
drillDown
Boolean Permission to drill down in a Chart. Default value - false.
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
7395 ,
8083 ,
8518 ,
8535
Get Slideshows
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetSlideshows ( IAnalyticsClient ac )
{
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
List < Dictionary < string , object >> slideshows = workspace . GetSlideshows ();
Console . WriteLine ( slideshows );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetSlideshows ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetSlideshows ( ac ZAnalytics . Client ) {
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetSlideshows ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetSlideshows ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getSlideshows ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getSlideshows ( AnalyticsClient ac ) throws Exception {
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONArray result = workspace . getSlideshows ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getSlideshows () {
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getSlideshows ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getSlideshows ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_slideshows ( self , ac ):
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_slideshows ()
print ( result )
try :
obj = sample ()
obj . get_slideshows ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getSlideshows (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/slides"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/slides
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get slideshows" ,
"data" : {
"slideshows" : [
{
"slideName" : "Slideshows 1" ,
"slideId" : "1767024000003149001" ,
"accessType" : 0
} ,
{
"slideName" : "Slideshows 2" ,
"slideId" : "1767024000003120002" ,
"accessType" : 1
}
]
}
}
Returns list of slideshows for the specified workspace.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/slides
oauthscope: ZohoAnalytics.embed.read
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
7395 ,
8083 ,
8518 ,
8535
Get Slideshow Details
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetSlideshowDetails ( IAnalyticsClient ac )
{
long slideId = 114874600000267890 ;
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
Dictionary < string , object > slideshowInfo = workspace . GetSlideshowDetails ( slideId );
Console . WriteLine ( slideshowInfo );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetSlideshowDetails ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetSlideshowDetails ( ac ZAnalytics . Client ) {
slideid := "35130000001396003"
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetSlideshowDetails ( slideid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetSlideshowDetails ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getSlideshowDetails ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getSlideshowDetails ( AnalyticsClient ac ) throws Exception {
long slideId = 35130000001396003 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
JSONObject result = workspace . getSlideshowDetails ( slideId );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getSlideshowDetails () {
$slide_id = "35130000001396003" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getSlideshowDetails ( $slide_id );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getSlideshowDetails ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_slideshow_details ( self , ac ):
slide_id = ""
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_slideshow_details ( slide_id )
print ( result )
try :
obj = sample ()
obj . get_slideshow_details ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var slideId = '' ;
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getSlideshowDetails ( slideId ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
slideId = "5888000000222001" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/slides/" + slideId
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/slides/<slide-id>
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get slideshow details" ,
"data" : {
"slideInfo" : {
"slideId" : "1767024000003149001" ,
"slideKey" : "9a4c1042011ce02fc4a3182fa75a22a9" ,
"slideName" : "Slideshows 1" ,
"accessType" : 0,
"viewIds" : [
"1767024000003013087" ,
"1767024000003015001" ,
"1767024000003011002" ,
]
}
}
}
Returns details of the specified slide.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/slides/<slide-id>
oauthscope: ZohoAnalytics.embed.read
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
7395 ,
8083 ,
8518 ,
8535
Get Slideshow URL
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void GetSlideshowURL ( IAnalyticsClient ac )
{
long slideId = 114874600000267890 ;
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
string slideshowUrl = workspace . GetSlideshowURL ( slideId , null );
Console . WriteLine ( slideshowUrl );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetSlideshowURL ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func GetSlideshowUrl ( ac ZAnalytics . Client ) {
slideid := "35130000001396003"
config := map [ string ] interface {}{}
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . GetSlideshowUrl ( slideid , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetSlideshowUrl ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getSlideshowUrl ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getSlideshowUrl ( AnalyticsClient ac ) throws Exception {
long slideId = 35130000001396003 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
String result = workspace . getSlideshowURL ( slideId , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getSlideshowUrl () {
$slide_id = "35130000001396003" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> getSlideshowUrl ( $slide_id );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getSlideshowUrl ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_slideshow_url ( self , ac ):
slide_id = "35130000001396003"
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . get_slideshow_url ( slide_id )
print ( result )
try :
obj = sample ()
obj . get_slideshow_url ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var slideId = '' ;
var config = {};
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . getSlideshowUrl ( slideId , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
slideId = "5888000000222001" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/slides/" + slideId + "/publish"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/slides/<slide-id>/publish
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get slideshow url" ,
"data" : {
"slideUrl" : "https://analyticsapi.zoho.com/ZDBSlideshow.cc?SLIDEID=1767024000003139001&SLIDEKEY=9c4a1042011ce02fc4a3182fa75a22a9&AUTOPLAY=true&INTERVAL=25&INCLUDETITLE=true&INCLUDEDESC=true&SOCIALWIDGETS=false"
}
}
Returns slide URL to access the specified slide.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/slides/<slide-id>/publish
oauthscope: ZohoAnalytics.embed.read
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
includeTitle
Boolean To display the view name in the embedded mode. Default value - true.
includeDesc
Boolean To display the view description in the embedded mode. Default value - true.
includeSocialWidgets
Boolean To include the social widgets in the slide. Default value - false.
autoplay
Boolean To scroll to the next view in the slideshow automatically. Default value - false.
withCustomDomain
Boolean To get the slide url with your custom domain address. Default value - false.
slideInterval
Integer Interval time(in seconds) Time interval at which the views present in the slideshow switch. Note:value should be between 10 to 300.
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
7395 ,
8083 ,
8518 ,
8535
Create Slideshow
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void CreateSlideshow ( IAnalyticsClient ac )
{
string slideName = "Slideshows 1" ;
List < long > viewIds = new List < long >();
viewIds . Add ( 35730000007354002 );
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
long slideId = workspace . CreateSlideshow ( slideName , viewIds , null );
Console . WriteLine ( slideId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . CreateSlideshow ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func CreateSlideshow ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
slidename := ""
viewids := [ 1 ] string {}
viewids [ 0 ] = ""
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
result , exception := workspace . CreateSlideshow ( slidename , viewids , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
CreateSlideshow ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . createSlideshows ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void createSlideshows ( AnalyticsClient ac ) throws Exception {
String slideName = "" ;
JSONArray viewIds = new JSONArray ();
viewIds . put ( "" );
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
long result = workspace . createSlideshow ( slideName , viewIds , null );
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function createSlideshow () {
$slide_name = "Sample 1" ;
$view_ids = array ( "" );
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$response = $workspace -> createSlideshow ( $slide_name , $view_ids );
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> createSlideshow ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def create_slideshow ( self , ac ):
slide_name = "Slideshow 1"
view_ids = []
view_ids . append ( "35130000001080100" )
view_ids . append ( "35130000001102015" )
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
result = workspace . create_slideshow ( slide_name , view_ids )
print ( result )
try :
obj = sample ()
obj . create_slideshow ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var slideName = '' ;
var viewIds = [];
viewIds . push ( '' );
viewIds . push ( '' );
var config = {};
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . createSlideshow ( slideName , viewIds , config ). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
slideName = "Slideshow 1" ;
viewIds = {};
viewIds.add ( "35130000001354002" );
viewIds.add ( "35130000001355005" );
config = Map ();
config.put ( "slideName" , slideName );
config.put ( "viewIds" , viewIds );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/slides"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/slides?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"slideName": "<slide-name>",
"viewIds": ["<view-id1>", "<view-id2>"]
}
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Create slideshow" ,
"data" : {
"slideId" : "1767024000003151001" ,
"slideUrl" : "https://analyticsapi.zoho.com/ZDBSlideshow.cc?SLIDEID=1767024000003151001&SLIDEKEY=69ba2ec9bfbe548f494bdf798087db41&AUTOPLAY=true&INTERVAL=25&INCLUDETITLE=true&INCLUDEDESC=true&SOCIALWIDGETS=false"
}
}
Create a slideshow in the specified workspace.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/slides
oauthscope: ZohoAnalytics.embed.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
slideName*
String Name of the slideshow.
viewIds*
JSONArray View ids to be included in the slideshow.Sample: ["viewId1","viewId2"]
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
7395 ,
8083 ,
8518 ,
8535
Update Slideshow
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void UpdateSlideshow ( IAnalyticsClient ac )
{
long slideId = 114874600000267890 ;
List < long > viewIds = new List < long >();
viewIds . Add ( 35730000007354002 );
Dictionary < string , object > config = new Dictionary < string , object >();
config . Add ( "viewIds" , viewIds );
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
workspace . UpdateSlideshow ( slideId , config );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . UpdateSlideshow ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func UpdateSlideshow ( ac ZAnalytics . Client ) {
slideid := "1767024000003151001"
config := map [ string ] interface {}{}
slidename := "NewSlidename"
viewids := [ 1 ] string {}
viewids [ 0 ] = "35130000001354002"
config [ "slideName" ] = slidename
config [ "viewIds" ] = viewids
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . UpdateSlideshow ( slideid , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
UpdateSlideshow ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . updateSlideshow ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void updateSlideshow ( AnalyticsClient ac ) throws Exception {
long slideId = 148746000002541001 l ;
String slideName = "NewSlidename" ;
JSONArray viewIds = new JSONArray ();
viewIds . put ( "35130000001354002" );
JSONObject config = new JSONObject ();
config . put ( "slideName" , slideName );
config . put ( "viewIds" , viewIds );
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . updateSlideshow ( slideId , config );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function updateSlideshow () {
$slide_id = "1767024000003151001" ;
$slide_name = "NewSlidename" ;
$view_ids = array ( "35130000001080001" , "35130000001080082" );
$config = array ();
$config [ "slideName" ] = $slide_name ;
$config [ "viewIds" ] = $view_ids ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> updateSlideshow ( $slide_id , $config );
}
}
$test_obj = new Test ();
try {
$test_obj -> updateSlideshow ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def update_slideshow ( self , ac ):
slide_id = "1767024000003151001"
config = {}
config [ "slideName" ] = "NewSlidename"
config [ "accessType" ] = "1"
view_ids = []
view_ids . append ( "35130000001102001" )
view_ids . append ( "35130000001102034" )
config [ "viewIds" ] = view_ids
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . update_slideshow ( slide_id , config )
print ( "success" )
try :
obj = sample ()
obj . update_slideshow ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var slideId = '1767024000003151001' ;
var slideName = 'NewSlidename' ;
var viewIds = [];
viewIds . push ( '35130000001102001' );
viewIds . push ( '35130000001102034' );
var config = {};
config [ "slideName" ] = slideName ;
config [ "viewIds" ] = viewIds ;
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . updateSlideshow ( slideId , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
slideId = "5888000000222001" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
slideName = "NewSlidename" ;
config = Map ();
config.put ( "slideName" , slideName );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/slides/" + slideId + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/slides/<slide-id>?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"slideName": "<slide-name>"
}
Sample Response:
HTTP/1.1 204 No Content
Update details of the specified slideshow.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/slides/<slide-id>
oauthscope: ZohoAnalytics.embed.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
slideName
String The new name of the slide.
viewIds
JSONArray View ids to be included in the slideshow.Sample: ["viewId1","viewId2"]
regenerateSlideKey
Boolean To generate a new slidekey, previously generated link will be disabled. Default value - false.
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
7395 ,
8083 ,
8518 ,
8535
Delete Slideshow
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
long workspaceId = 35130000001055707 ;
public void DeleteSlideshow ( IAnalyticsClient ac )
{
long slideId = 114874600000267890 ;
IWorkspaceAPI workspace = ac . GetWorkspaceInstance ( orgId , workspaceId );
workspace . DeleteSlideshow ( slideId );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . DeleteSlideshow ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
workspaceId = "35130000001055707"
)
func DeleteSlideshow ( ac ZAnalytics . Client ) {
slideid := ""
workspace := ZAnalytics . GetWorkspaceInstance ( & ac , orgId , workspaceId )
exception := workspace . DeleteSlideshow ( slideid )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
DeleteSlideshow ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
private long workspaceId = 35130000001055707 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . deleteSlideshow ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void deleteSlideshow ( AnalyticsClient ac ) throws Exception {
long slideId = 148746000002541001 l ;
WorkspaceAPI workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . deleteSlideshow ( slideId );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
public $workspace_id = "35130000001055707" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function deleteSlideshow () {
$slide_id = "" ;
$workspace = $this -> ac -> getWorkspaceInstance ( $this -> org_id , $this -> workspace_id );
$workspace -> deleteSlideshow ( $slide_id );
}
}
$test_obj = new Test ();
try {
$test_obj -> deleteSlideshow ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
WORKSPACEID = "35130000001055707" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def delete_slideshow ( self , ac ):
slide_id = ""
workspace = ac . get_workspace_instance ( Config . ORGID , Config . WORKSPACEID )
workspace . delete_slideshow ( slide_id )
print ( "success" )
try :
obj = sample ()
obj . delete_slideshow ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var workspaceId = '35130000001055707' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var slideId = '' ;
var workspace = ac . getWorkspaceInstance ( orgId , workspaceId );
workspace . deleteSlideshow ( slideId ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
workspaceId = "35130000001055707" ;
slideId = "5888000000222001" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/workspaces/" + workspaceId + "/slides/" + slideId
type : DELETE
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/workspaces/<workspace-id>/slides/<slide-id>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 204 No Content
Delete a specified slideshow in the workspace.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/workspaces/<workspace-id>/slides/<slide-id>
oauthscope: ZohoAnalytics.embed.delete
Possible Error Codes
7103 ,
7104 ,
7301 ,
7387 ,
7395 ,
8083 ,
8518 ,
8535
Error codes in Embed API
Sample Error:
HTTP/1.1 400 Bad Request
Content-Type:application/json;charset=UTF-8
{
"status" : "failure" ,
"summary" : "ATTRIBUTE_NOT_PRESENT_IN_JSON_CONFIGURATION" ,
"data" : {
"errorCode" : 8079,
"errorMessage" : "Attribute 'viewIds' not present in the JSON configuration. Kindly provide a valid JSON configuration."
}
}
This section lists all possible error codes that could be sent from the Zoho Analytics server on failure of Embed APIs. You can use this for appropriate error handling.
Error Codes
Error-Code
Reason
Solution
7103
The workspace id mentioned in the API does not exist.
Provide the valid workspace id.
7104
The view id specified in the API does not exist.
Provide the valid view id.
7301
You (your full name) do not have the permission to do this operation.
Access as administrator or permitted user to perform the operation.
7387
Workspaces does not belongs to current organization.
Provide a valid organization and workspace id.
7395
Column not present in the workspace.
Provide a valid column.
8060
Domain does not exist.
Provide a valid domain name that you have purchased from Zoho Analytics.
8078
The mentioned attribute has an empty value.
Provide a valid JSON data.
8079
The mentioned attribute is not present in the JSON configuration.
Provide a valid JSON data.
8083
Organization id is not present in the request header.
Provide a valid organization id in the request header.
8504
The required parameter is not proper or has not been sent.
Send the parameter with valid data.
8518
Invalid authentication.
Provide a valid OAuth token for API authentication.
8535
Invalid oauthtoken.
Provide a valid OAuth token.
In case of any error other than the above said, mail the API request URL parameters and error response details to support@zohoanalytics.com . Zoho Analytics Team will get back to you with the best possible solution.
User Management API
Manage user APIs are used to Add / Remove / Activate / Deactivate users to your Zoho Analytics organization.
Note:This APIs cannot be used to create user accounts in Zoho. This is just meant to associate an existing Zoho user to a Zoho Analytics organization held by an administrator.
Get Users
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
public void GetUsers ( IAnalyticsClient ac )
{
IOrgAPI org = ac . GetOrgInstance ( orgId );
List < Dictionary < string , object >> users = org . GetUsers ();
Console . WriteLine ( users );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetUsers ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func GetUsers ( ac ZAnalytics . Client ) {
org := ZAnalytics . GetOrgInstance ( & ac , orgId )
result , exception := org . GetUsers ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetUsers ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getUsers ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getUsers ( AnalyticsClient ac ) throws Exception {
OrgAPI org = ac . getOrgInstance ( orgId );
JSONArray result = org . getUsers ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getUsers () {
$org = $this -> ac -> getOrgInstance ( $this -> org_id );
$response = $org -> getUsers ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getUsers ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_users ( self , ac ):
org = ac . get_org_instance ( Config . ORGID )
result = org . get_users ()
print ( result )
try :
obj = sample ()
obj . get_users ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var org = ac . getOrgInstance ( orgId );
org . getUsers (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/users"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/users
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get users" ,
"data" : {
"users" : [
{
"emailId" : "user1@gmail.com" ,
"status" : true ,
"role" : "Organization Admin"
} ,
{
"emailId" : "user2@gmail.com" ,
"status" : true ,
"role" : "User"
}
]
}
}
Returns list of users for the specified organization.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/users
oauthscope: ZohoAnalytics.usermanagement.read
Possible Error Codes
7301 ,
8078 ,
8079 ,
8083 ,
8504 ,
8509 ,
8518 ,
8535
Add Users
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
public void AddUsers ( IAnalyticsClient ac )
{
IOrgAPI org = ac . GetOrgInstance ( orgId );
List < string > emailIds = new List < string >();
emailIds . Add ( "user+1@zoho.com" );
org . AddUsers ( emailIds , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . AddUsers ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func AddUsers ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
emailids := [ 1 ] string {}
emailids [ 0 ] = "user+1@zoho.com"
org := ZAnalytics . GetOrgInstance ( & ac , orgId )
exception := org . AddUsers ( emailids , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
AddUsers ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . addUsers ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void addUsers ( AnalyticsClient ac ) throws Exception {
OrgAPI org = ac . getOrgInstance ( orgId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "user+101@zoho.com" );
org . addUsers ( emailIds , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function addUsers () {
$email_ids = array ( "user+2@zoho.com" );
$org = $this -> ac -> getOrgInstance ( $this -> org_id );
$org -> addUsers ( $email_ids , NULL );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> addUsers ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def add_users ( self , ac ):
email_ids = []
email_ids . append ( "user+1@zoho.com" )
org = ac . get_org_instance ( Config . ORGID )
org . add_users ( email_ids )
print ( "success" )
try :
obj = sample ()
obj . add_users ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var emailIds = [];
emailIds . push ( '' );
emailIds . push ( '' );
var org = ac . getOrgInstance ( orgId );
org . addUsers (emailIds , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
config = Map ();
config.put ( "emailIds" , emailIds );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/users"
type : POST
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/users?CONFIG=<encoded_json_value>
-X 'POST'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"]
}
Sample Response:
HTTP/1.1 204 No Content
Add users to the specified organization.
request uri
POST https://<ZohoAnalytics_Server_URI >/restapi/v2/users
oauthscope: ZohoAnalytics.usermanagement.create
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the users to be added.Sample: ["emailId1", "emailId2"]
role
String To specify the role for the new users. Supported roles:Default Value: USER
domainName
String Name of the domain. To add users to the specified domain.
Possible Error Codes
7301 ,
8060 ,
8078 ,
8079 ,
8083 ,
8504 ,
8509 ,
8518 ,
8535
Remove Users
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
public void RemoveUsers ( IAnalyticsClient ac )
{
IOrgAPI org = ac . GetOrgInstance ( orgId );
List < string > emailIds = new List < string >();
emailIds . Add ( "user+1@zoho.com" );
org . RemoveUsers ( emailIds , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . RemoveUsers ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func RemoveUsers ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
emailids := [ 1 ] string {}
emailids [ 0 ] = "user+1@zoho.com"
org := ZAnalytics . GetOrgInstance ( & ac , orgId )
exception := org . RemoveUsers ( emailids , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
RemoveUsers ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . removeUsers ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void removeUsers ( AnalyticsClient ac ) throws Exception {
OrgAPI org = ac . getOrgInstance ( orgId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "user+101@zoho.com" );
org . removeUsers ( emailIds , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function removeUsers () {
$email_ids = array ( "user+2@zoho.com" );
$org = $this -> ac -> getOrgInstance ( $this -> org_id );
$org -> removeUsers ( $email_ids );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> removeUsers ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def remove_users ( self , ac ):
email_ids = []
email_ids . append ( "user+1@zoho.com" )
org = ac . get_org_instance ( Config . ORGID )
org . remove_users ( email_ids )
print ( "success" )
try :
obj = sample ()
obj . remove_users ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var emailIds = [];
emailIds . push ( '' );
emailIds . push ( '' );
var org = ac . getOrgInstance ( orgId );
org . removeUsers (emailIds , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
config = Map ();
config.put ( "emailIds" , emailIds );
paramsMap = Map ();
paramsMap.put ( "CONFIG" , config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/users"
type : DELETE
parameters : paramsMap
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/users?CONFIG=<encoded_json_value>
-X 'DELETE'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"]
}
Sample Response:
HTTP/1.1 204 No Content
Remove users from the specified organization.
request uri
DELETE https://<ZohoAnalytics_Server_URI >/restapi/v2/users
oauthscope: ZohoAnalytics.usermanagement.delete
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the users to be removed.Sample: ["emailId1", "emailId2"]
domainName
String Name of the domain. To remove users from the specified domain.
Possible Error Codes
7301 ,
8060 ,
8078 ,
8079 ,
8083 ,
8504 ,
8509 ,
8518 ,
8535
Activate Users
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
public void ActivateUsers ( IAnalyticsClient ac )
{
IOrgAPI org = ac . GetOrgInstance ( orgId );
List < string > emailIds = new List < string >();
emailIds . Add ( "user+1@zoho.com" );
org . ActivateUsers ( emailIds , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . ActivateUsers ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func ActivateUsers ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
emailids := [ 1 ] string {}
emailids [ 0 ] = "user+1@zoho.com"
org := ZAnalytics . GetOrgInstance ( & ac , orgId )
exception := org . ActivateUsers ( emailids , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
ActivateUsers ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . activateUsers ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void activateUsers ( AnalyticsClient ac ) throws Exception {
OrgAPI org = ac . getOrgInstance ( orgId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "user+101@zoho.com" );
org . activateUsers ( emailIds , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function activateUsers () {
$email_ids = array ( "user+2@zoho.com" );
$org = $this -> ac -> getOrgInstance ( $this -> org_id );
$org -> activateUsers ( $email_ids );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> activateUsers ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def activate_users ( self , ac ):
email_ids = []
email_ids . append ( "user+1@zoho.com" )
org = ac . get_org_instance ( Config . ORGID )
org . activate_users ( email_ids )
print ( "success" )
try :
obj = sample ()
obj . activate_users ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var emailIds = [];
emailIds . push ( '' );
emailIds . push ( '' );
var org = ac . getOrgInstance ( orgId );
org . activateUsers (emailIds , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
config = Map ();
config.put ( "emailIds" , emailIds );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/users/active" + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/users/active?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"]
}
Sample Response:
HTTP/1.1 204 No Content
Activate users in the specified organization.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/users/active
oauthscope: ZohoAnalytics.usermanagement.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the users to be activated.Sample: ["emailId1", "emailId2"]
domainName
String Name of the domain To activate users in the specified domain.
Possible Error Codes
7301 ,
8060 ,
8078 ,
8079 ,
8083 ,
8504 ,
8509 ,
8518 ,
8535
Deactivate Users
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
public void DeactivateUsers ( IAnalyticsClient ac )
{
IOrgAPI org = ac . GetOrgInstance ( orgId );
List < string > emailIds = new List < string >();
emailIds . Add ( "user+1@zoho.com" );
org . DeactivateUsers ( emailIds , null );
Console . WriteLine ( "success" );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . DeactivateUsers ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func DeactivateUsers ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
emailids := [ 1 ] string {}
emailids [ 0 ] = "user+1@zoho.com"
org := ZAnalytics . GetOrgInstance ( & ac , orgId )
exception := org . DeactivateUsers ( emailids , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
DeactivateUsers ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . deactivateUsers ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void deactivateUsers ( AnalyticsClient ac ) throws Exception {
OrgAPI org = ac . getOrgInstance ( orgId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "user+101@zoho.com" );
org . deactivateUsers ( emailIds , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function deactivateUsers () {
$email_ids = array ( "user+2@zoho.com" );
$org = $this -> ac -> getOrgInstance ( $this -> org_id );
$org -> deactivateUsers ( $email_ids );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> deactivateUsers ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def deactivate_users ( self , ac ):
email_ids = []
email_ids . append ( "user+1@zoho.com" )
org = ac . get_org_instance ( Config . ORGID )
org . deactivate_users ( email_ids )
print ( "success" )
try :
obj = sample ()
obj . deactivate_users ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var emailIds = [];
emailIds . push ( '' );
emailIds . push ( '' );
var org = ac . getOrgInstance ( orgId );
org . deActivateUsers (emailIds , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
config = Map ();
config.put ( "emailIds" , emailIds );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/users/inactive" + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/users/inactive?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"]
}
Sample Response:
HTTP/1.1 204 No Content
Deactivate users in the specified organization.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/users/inactive
oauthscope: ZohoAnalytics.usermanagement.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the users to be deactivated.Sample: ["emailId1", "emailId2"]
domainName
String Name of the domain. To deactivate users in the specified domain.
Possible Error Codes
7301 ,
8060 ,
8078 ,
8079 ,
8083 ,
8504 ,
8509 ,
8518 ,
8535
Change User Role
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
public void ChangeUserRole ( IAnalyticsClient ac )
{
IOrgAPI org = ac . GetOrgInstance ( orgId );
List < string > emailIds = new List < string >();
emailIds . Add ( "user+1@zoho.com" );
string role = "USER" ;
org . ChangeUserRole ( emailIds , role , null );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . ChangeUserRole ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func ChangeUserRole ( ac ZAnalytics . Client ) {
config := map [ string ] interface {}{}
emailids := [ 1 ] string {}
emailids [ 0 ] = "user+1@zoho.com"
role := "VIEWER"
org := ZAnalytics . GetOrgInstance ( & ac , orgId )
exception := org . ChangeUserRole ( emailids , role , config )
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( "success" )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
ChangeUserRole ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . changeUserRole ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void changeUserRole ( AnalyticsClient ac ) throws Exception {
OrgAPI org = ac . getOrgInstance ( orgId );
JSONArray emailIds = new JSONArray ();
emailIds . put ( "user+1@zoho.com" );
String role = "USER" ;
org . changeUserRole ( emailIds , role , null );
System . out . println ( "success" );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function changeUserRole () {
$email_ids = array ( "user+2@zoho.com" );
$role = "USER" ;
$org = $this -> ac -> getOrgInstance ( $this -> org_id );
$org -> changeUserRole ( $email_ids , $role );
echo "success \n " ;
}
}
$test_obj = new Test ();
try {
$test_obj -> changeUserRole ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def change_user_role ( self , ac ):
email_ids = []
email_ids . append ( "user+1@zoho.com" )
role = "USER"
org = ac . get_org_instance ( Config . ORGID )
org . change_user_role ( email_ids , role )
print ( "success" )
try :
obj = sample ()
obj . change_user_role ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var config = {};
var emailIds = [];
emailIds . push ( '' );
emailIds . push ( '' );
var role = '' ;
var org = ac . getOrgInstance ( orgId );
org . changeUserRole ( emailIds , role , config ). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
emailIds = {};
emailIds.add ( "user+1@zoho.com" );
emailIds.add ( "user+2@zoho.com" );
role = "USER" ;
config = Map ();
config.put ( "emailIds" , emailIds );
config.put ( "role" , role );
parameters = "CONFIG=" + zoho.encryption.urlEncode ( config.toString ());
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/users/role" + "?" + parameters
type : PUT
headers : headersMap
connection : "analytics_oauth_connection"
];
Copy
curl https://analyticsapi.zoho.com/restapi/v2/users/role?CONFIG=<encoded_json_value>
-X 'PUT'
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Sample value for CONFIG parameter:
Copy
{
"emailIds": ["<email-id1>", "<email-id2>"],
"role": "USER"
}
Sample Response:
HTTP/1.1 204 No Content
Change role for the specified users.
request uri
PUT https://<ZohoAnalytics_Server_URI >/restapi/v2/users/role
oauthscope: ZohoAnalytics.usermanagement.update
Query Parameters
Parameter Name
Description
CONFIG*
JSONObject Config parameter specifications are available in the below section.
Fields for CONFIG JSON
Key
Description
emailIds*
JSONArray The email address of the users to be deactivated.Sample: ["emailId1", "emailId2"]
role*
String To update the role for the specified users. Supported roles:
domainName
String Name of the domain To update users role in the specified domain.
Possible Error Codes
7301 ,
8060 ,
8078 ,
8079 ,
8083 ,
8504 ,
8509 ,
8518 ,
8535
Get Subscription Details
Download client libraries : C# | GO | JAVA | PHP | PYTHON | NODEJS
Sample Request:
Copy
using System ;
using System.Collections.Generic ;
using ZohoAnalytics ;
namespace ZohoAnalyticsTest
{
class Program
{
long orgId = 55522777 ;
public void GetSubscriptionDetails ( IAnalyticsClient ac )
{
IOrgAPI org = ac . GetOrgInstance ( orgId );
Dictionary < string , object > subscriptionInfo = org . GetSubscriptionDetails ();
Console . WriteLine ( subscriptionInfo );
}
static void Main ( string [] args )
{
string clientId = "1000.xxxxxxx" ;
string clientSecret = "xxxxxxx" ;
string refreshToken = "1000.xxxxxxx.xxxxxxx" ;
try
{
IAnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
Program obj = new Program ();
obj . GetSubscriptionDetails ( ac );
}
catch ( ServerException ex )
{
Console . WriteLine ( "Server exception - " + ex . GetErrorMessage ());
}
catch ( Exception ex )
{
Console . WriteLine ( "Other exception - " + ex . Message );
}
}
}
}
Copy
package main
import (
"fmt"
ZAnalytics "zoho/pkg/analyticsclient"
)
var (
clientId = "1000.xxxxxxx"
clientSecret = "xxxxxxx"
refreshToken = "1000.xxxxxxx.xxxxxxx"
orgId = "55522777"
)
func GetSubscriptionDetails ( ac ZAnalytics . Client ) {
org := ZAnalytics . GetOrgInstance ( & ac , orgId )
result , exception := org . GetSubscriptionDetails ()
if ( exception != nil ){
fmt . Println ( exception . ErrorMessage )
} else {
fmt . Println ( result )
}
}
func main () {
ac := ZAnalytics . GetAnalyticsClient ( clientId , clientSecret , refreshToken )
GetSubscriptionDetails ( ac )
}
Copy
import com.zoho.analytics.client.* ;
import org.json.* ;
public class Test {
private long orgId = 55522777 l ;
public static void main ( String args []){
String clientId = "1000.xxxxxxx" ;
String clientSecret = "xxxxxxx" ;
String refreshToken = "1000.xxxxxxx.xxxxxxx" ;
Test tObj = new Test ();
AnalyticsClient ac = new AnalyticsClient ( clientId , clientSecret , refreshToken );
try {
tObj . getSubscriptionDetails ( ac );
}
catch ( ServerException ex ) {
System . out . println ( "Server exception - ErrorCode : " + ex . getErrorCode () + ", ErrorMessage : " + ex . getErrorMessage ());
}
catch ( ParseException ex ) {
System . out . println ( "Parser exception - ErrorMessage : " + ex . getResponseMessage ());
}
catch ( Exception ex ) {
System . out . println ( "Other exception - " );
ex . printStackTrace ();
}
}
public void getSubscriptionDetails ( AnalyticsClient ac ) throws Exception {
OrgAPI org = ac . getOrgInstance ( orgId );
JSONObject result = org . getSubscriptionDetails ();
System . out . println ( result );
}
}
Copy
<?php
require 'AnalyticsClient.php' ;
class Test
{
public $ac = NULL ;
public $client_id = "1000.xxxxxxx" ;
public $client_secret = "xxxxxxx" ;
public $refresh_token = "1000.xxxxxxx.xxxxxxx" ;
public $org_id = "55522777" ;
function __construct () {
$this -> ac = new AnalyticsClient ( $this -> client_id , $this -> client_secret , $this -> refresh_token );
}
function getSubscriptionDetails () {
$org = $this -> ac -> getOrgInstance ( $this -> org_id );
$response = $org -> getSubscriptionDetails ();
print_r ( $response );
}
}
$test_obj = new Test ();
try {
$test_obj -> getSubscriptionDetails ();
}
catch ( ServerException $se ) {
echo "Server exception : " . $se -> getErrorMessage () . " \n " ;
}
catch ( IOException $ioe ) {
echo "IO exception : " . $ioe -> getErrorMessage () . " \n " ;
}
catch ( ParseException $pe ) {
echo "Parser exception : " . $pe -> getErrorMessage () . " \n " ;
}
catch ( Exception $e ) {
echo "Exception : " . $e -> getErrorMessage () . " \n " ;
}
?>
Copy
from __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json
class Config :
CLIENTID = "1000.xxxxxxx" ;
CLIENTSECRET = "xxxxxxx" ;
REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx" ;
ORGID = "55522777" ;
class sample :
ac = AnalyticsClient ( Config . CLIENTID , Config . CLIENTSECRET , Config . REFRESHTOKEN )
def get_subscription_details ( self , ac ):
org = ac . get_org_instance ( Config . ORGID )
result = org . get_subscription_details ()
print ( result )
try :
obj = sample ()
obj . get_subscription_details ( obj . ac );
except Exception as e :
print ( str ( e ))
Copy
var analyticsClient = require ( './AnalyticsClient' );
var clientId = '1000.xxxxxxx' ;
var clientSecret = 'xxxxxxx' ;
var refreshtoken = '1000.xxxxxxx.xxxxxxx' ;
var orgId = '55522777' ;
var ac = new analyticsClient ( clientId , clientSecret , refreshtoken );
var org = ac . getOrgInstance ( orgId );
org . getSubscriptionDetails (). then (( response ) => {
console . log ( response );
}). catch (( error ) => {
console . log ( 'errorCode : ' + error . errorCode );
console . log ( 'errorMessage : ' + error . errorMessage );
});
Copy
orgId = "55522777" ;
headersMap = Map ();
headersMap.put ( "ZANALYTICS-ORGID" , orgId );
response = invokeurl
[
url : "https://analyticsapi.zoho.com/restapi/v2/subscription"
type : GET
headers : headersMap
connection : "analytics_oauth_connection"
];
info response ;
Copy
curl https://analyticsapi.zoho.com/restapi/v2/subscription
-H 'ZANALYTICS-ORGID: <org-id >'
-H 'Authorization: Zoho-oauthtoken <access_token >'
Response Code:200
Sample Response:
HTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8
{
"status" : "success" ,
"summary" : "Get subscription details" ,
"data" : {
"subscription" : {
"planName" : "Premium" ,
"addOns" : "Zoho Recruit Connector,Zoho Books Connector" ,
"billingDate" : " - " ,
"trialStatus" : false
}
}
}
Returns subscription details of the specified organization.
request uri
GET https://<ZohoAnalytics_Server_URI >/restapi/v2/subscription
oauthscope: ZohoAnalytics.usermanagement.read
Possible Error Codes
8504 , 8506 , 8516
Error codes in UserManagement API
Sample Error:
HTTP/1.1 400 Bad Request
Content-Type:application/json;charset=UTF-8
{
"status" : "failure" ,
"summary" : "LESS_THAN_MIN_OCCURANCE" ,
"data" : {
"errorCode" : 8504,
"errorMessage" : "The parameter CONFIG is not proper(Has not been sent or is less than required count)"
}
}
This section lists all possible error codes that could be sent from the Zoho Analytics server on failure of UserManagement APIs. You can use this for appropriate error handling.
Error Codes
Error-Code
Reason
Solution
6021
Activating Users not allowed since the users count exceeds the allowed limit for your Zoho Analytics Plan.
You can upgrade your Zoho Analytics Account or you can get additional users as add-ons. You can manage your plan by clicking the “Subscription” link at top after you log into Zoho Analytics. For more details on Zoho Analytics pricing visit: https://www.zoho.com/analytics/zohoreports-pricing.html .
7301
You (your full name) do not have the permission to do this operation.
Access as administrator or permitted user to perform the operation.
8060
Domain does not exist.
Provide a valid domain name that you have purchased from Zoho Analytics.
8078
The mentioned attribute has an empty value.
Provide a valid JSON data.
8079
The mentioned attribute is not present in the JSON configuration.
Provide a valid JSON data.
8083
Organization id is not present in the request header.
Provide a valid organization id in the request header.
8504
The required parameter is not proper or has not been sent.
Send the parameter with valid data.
8506
The mentioned parameter has been sent more than the required count.
Check and remove that extra parameter mentioned in the response.
8509
The Email Ids provided is not proper / not in the EMAIL ID format.
Provide a proper email address.
8516
Invalid value passed in the mentioned parameter.
Provide the valid data to the mentioned parameter.
8518
Invalid authentication.
Provide a valid OAuth token for API authentication.
In case you encounter any other errors, please mail the API request URL parameters and error response details to support@zohoanalytics.com . Zoho Analytics Team will get back to you shortly with the best possible solution.
This section lists the APIs which can be used only by White Label customers (full rebranding) to easily implement single sign-on in their application for seamless user management .
Zoho Analytics offer a full-fledged white label (private label) solution. As a part of it, supports Single Sign on (SSO) with your website / application. Using the below mentioned procedure, it would be possible for you to implement a loosely coupled login mechanism for the white labeled Zoho Analytics solution, that works with almost ANY authentication system that you currently are using. This would involve program changes in your website/application (code to be written at your end). This page outlines the various steps to setup, perform unit/integration testing and to go live with Zoho’s third party SSO integration.
Setup Phase
Provide the following information to the Zoho Analytics team:
IP addresses of your test and production setups
The login and logout page URLs of your website (these will process login and logout requests coming from Zoho Analytics; needed for your test and production setups too)
Domain/sub-domain names (CNAME mapping) for test and production setups. CNAME maps your test/production sub-domains to analytics.cs.zohohost.com
Fill the following Zoho Creator form to design your custom page - https://creator.zoho.com/zohodbhelp/domain-rebranding/#Form:DomainProperties
After submitting the above information to the Zoho Analytics team, we will send you an API key to be used you. (this is a different API key than the one provided at http://api.zoho.com/ )
Sign Up API
Sample Request:
curl -d "apikey=apikey&operation=signup&email=[email id of the user to signup] &full_name=[Full Name of the user]"
https://[your domain]/sso
Sample Success Response
{
"ticket" :"666b88566441b69d1a137db824314b6a9be8959a75b1a1be8b951c6e18f352
bb2e068f7f697fa4879e365e19967a5b537a08c8e85058625130e54e8467d
85259" ,
"result" :"success" ,
"zuid" :5471
}
Sample Failure Response
{
"result" :"failure" ,
"cause" :"Invalid APIKey"
}
Assuming your domain URL is analytics.finepick.com.
form method="POST" action="https://analytics.finepick.com/sso" target="_self"
input type= "hidden" name ="apikey" value="[your apikey]"
input type ="hidden" name ="operation" value ="signup"
input type ="hidden" name ="email" value ="[email id of the user to signup]"
input type ="hidden" name ="full_name" value ="[Full Name of the user]"
input type ="submit" name ="Sign Up" value ="submit"
/form
Important: You need to send an HTTPS POST request to Zoho Analytics for user Sign Up API.
Parameter Name
Description
operation
Value is “signup”
email
Email Id of the user to sign up
full_name (optional)
Full Name of the user
apikey
Your API key
Response for Sign Up API:
Both Success & Failure responses are present in JSON format.
Return Value
Description
result
success/failure If API call is success, then success value is present in the result attribute; else failure value.
zuid
ID generated by the Zoho system. Unique per user email address. This needs to be stored against the user for whom sign up API is called. This will be useful for any communication / trouble shooting at a later stage.
ticket
This is used by the user to access the reports present in the Zoho Analytics. This needs to be passed to Zoho as part of the URL.
cause
This attribute is present in the response, only in case of failure.
Sign In API
Sample Request:
curl -d "apikey=apikey&operation=signin&email=[email id of the user to signin]"
https://[your domain]/sso
Sample Success Response
{
"ticket" :"666b88566441b69d1a137db824314b6a9be8959a75b1a1be8b951c6e18f352bb
2e068f7f697fa4879e365e19967a5b537a08c8e85058625130e54e8467d85259" ,
"result" :"success" ,
"redirect_url" :"https://analytics.finepick.com/oauthorize?state=https%3A%2F%2Fanalytics.finepick.com%2FZDBHome.cc&zacode=1001872501-19e446dc-2398a43e6108e59a0458d550f0714628&portal=1000756871" ,
"zuid" :5471
}
Sample Failure Response
{
"result" :"failure" ,
"cause" :"Invalid APIKey"
}
Assuming your domain URL is analytics.finepick.com.
form method="POST" action="https://analytics.finepick.com/sso" target="_self"
input type= "hidden" name ="apikey" value="[your apikey]"
input type ="hidden" name ="operation" value ="signin"
input type ="hidden" name ="email" value ="[email id of the user to signin]"
input type ="submit" name ="Sign In" value ="submit"
/form
Important: You need to send an HTTPS POST to Zoho Analytics for user Sign In API.
Parameter Name
Description
operation
Value is “signin”
apikey
Your API key
email
Email address of the user to sign in
STATE (optional)
Landing URL of specific workspace/view for redirection once the sign-in process is completed. Default value: https://[your domain]/ZDBHome.cc
Response for Sign in API:
Both success & failure responses are present in JSON format.
Return Value
Description
result
success/failure If the API call is successful, then success value is present in the result attribute; else failure value.
zuid
ID generated by the Zoho system. Unique per user email address. This needs to be stored against the user for whom sign in API is being called. This will be useful for any communication / trouble shooting at a later stage.
ticket
This is used by the user to access the reports present in the Zoho Analytics. This needs to be passed to Zoho as part of the URL.
redirect_url
This is used by the user to complete the signin process.
cause
This attribute present in the response, only in case of failure
Sign Out API
Sample Request:
curl https://[your domain]/ZDBCustomDomainLogin.ma?ZDBACTION=signout
https://analytics.finepick.com/ZDBCustomDomainLogin.ma?ZDBACTION=signout
Important: You need to do a HTTP 301 redirection to the above URL once the sign out process(clearing your application credential) is completed in your server/application. Once you do that, you will be redirected to the login page immediately after you sign out from Zoho Analytics.
Workflow Test Scenarios
This section outlines steps that are to be tried after the unit tests have been successfully completed.
Pre-Requisites:
Make sure that the domain name is mapped to the corresponding Zoho Analytics environment (analytics.cs.zohohost.com). For this particular documentation, we will assume that this domain mapping is https://analytics.finepick.com Replace this with your own mapping URL.
Zoho Analytics environment is located at analytics.cs.zohohost.com
Test Login Flow
Invoke the Sign Up or Sign In API.
Get the redirect_url value from the API response and invoke the URL in the browser.
Once the redirect_url is invoked, the sign-in process will be completed.
Test Logout Flow
After logging in using the steps above, invoke the Sign out API from your server/application to Zoho Analytics server.
Try using the same redirect url to visit your white label domain - you should be redirected to the registered login page of your website.
Test Login as Another user functionality
This step requires that you register 2 different email addressed using the Sign up API.
Test the login flow as the first User
Then use the redirect url for User 2 and visit the site (using the same steps outlined in Test Login flow). - Domain will ignore the second url when one session is already active - so you will still see the session as user 1.
Integration Test Scenarios
Website driven Login flow
User logs in to the main website.
User clicks on a link that leads to the white-label site.
White-label site requires login credentials of the user - which are not found in the current session
So Zoho Analytics routes the request to the registered login URL with a parameter called serviceurl that will contain the full URL where the request should be routed after login (e.g., https://finepick.com/login?serviceurl=https://analytics.finepick.com)
Since user is already logged in, finepick.com performs the sign in or sign up API call, depending on whether finepick.com already has the zuid for the user or not.
With the newly generated url, finepick.com routes the user’s browser to the service URL (in this example, https://analytics.finepick.com/oauthorize?zacode=[obtained_ticket]&portal=[portal_id]&state=https://analytics.finepick.com/ZDBHome.cc)
Now white label site recognizes the user.
White label driven Login flow
User visits the white label domain directly.
If no login credentials for the user is found, then Zoho Analytics will route the user the registered login url with a parameter called serviceurl. Serviceurl contains the full URL where the request should be routed to after login (for eg. https://finepick.com/login?serviceurl=https://analytics.finepick.com)
The login page of finepick.com, collects and processes the user’s login credentials based on the data stored in finepick.com
After succesfully logging the user into finepick.com, if the service URL is a white label URL, the server should invoke the Sign in or Sign up API for the current logged in user, and obtain a redirect url.
After successfully obtaining the redirect url, the user’s browser should be forwarded to the url denoted by service url (in this example,https://analytics.finepick.com/oauthorize?zacode=[obtained_ticket]&portal=[portal_id]&state=https://analytics.finepick.com/ZDBHome.cc)
Now the white label site (Zoho Analytics) recognizes the user.
Website Logout Flow:
When the user clicks on the logout URL in the website, the website should call the Zoho Analytics signout API and invalidate the ticket.
The signout API call is a must!
White -label Logout Flow:
When the user logs out from the reports site, he will be routed to the logout URL of the main site with the serviceurl parameter pointing to the community URL
Zoho will automatically clear all cookies and session information about the user from Zoho’s end.
Other Terms & Conditions:
Before going live, it is mandatory for you to include Zoho’s Terms and Conditions indicating that the community is hosted on Zoho and indicate Zoho’s Terms & Conditions URL. The exact wordings will be given by your account manager.
A full demo of the integration needs to be provided to the Zoho team.
Common error codes in API
This section lists the common error codes that could be sent from the Zoho Analytics server on failure of Zoho Analytics API. You can use this for appropriate error handling.
Error codes and reason
Error_code
Reason
Solution
7003
Required parameters are missing in the request.
Send all the required parameters related to that particular action.
7103
The workspace id mentioned in the API does not exist.
Provide the valid workspace id.
7104
The view id specified in the API does not exist.
Provide the valid view id.
7138
The view id mentioned in the API URL does not exist.
Check the view id in the request URL and provide a valid view id.
7301
You (your full name) do not have the permission to do this operation.
Access as administrator or permitted user to perform the operation.
7387
Workspaces does not belongs to current organization.
Provide a valid organization and workspace id.
7395
Column not present in the workspace.
Provide a valid column.
7925
You are not part of the analytics organization.
Create your analytics organization.
8002
Specified criteria is invalid.
Provide valid criteria.
8004
The column mentioned in the criteria is not present in the table.
Check the column name and provide the valid name.
8023
You do not have required permission to perform this operation.
Kindly contact our support team.
8025
Invalid custom domain.
Provide a valid domain name.
8060
Domain does not exist.
Provide a valid domain name that you have purchased from Zoho Analytics.
8078
The mentioned attribute has an empty value.
Provide a valid JSON data.
8079
The mentioned attribute is not present in the JSON configuration.
Provide a valid JSON data.
8083
Organization id is not present in the request header.
Provide a valid organization id in the request header.
8504
The required parameter is not proper or has not been sent.
Send the parameter with valid data.
8506
The mentioned parameter has been sent more than the required count.
Check and remove that extra parameter mentioned in the response.
8516
Invalid value passed in the mentioned parameter.
Provide the valid data to the mentioned parameter.
8518
Invalid authentication.
Provide a valid OAuth token for API authentication.
8534
Invalid JSON Format.
Provide a valid JSON data.
8535
Invalid oauthtoken.
Provide a valid OAuth token.
In case of any error other than the above said, mail the API request URL parameters and error response details to support@zohoanalytics.com . Zoho Analytics Team will get back to you with the best possible solution.
Client Libraries
Client libraries are programming language wrappers over the raw HTTP APIs. This enables developers to easily use Zoho Analytics API in the corresponding programming language. Currently we support the following programming language libraries:
Java Library
The Java client libraries wraps the raw HTTP based API of Zoho Analytics with easy to use methods for Java language. This enables Java developers to easily use Zoho Analytics API.
Environment Required: Java 1.8
Javadocs
Click here for javadocs .
Download Java Client Library
Download the java client library based on your Data Centre.
Release Notes
2.1.0
Newly added APIs
Changes on existing APIs
Copy Workspace : Added a new attribute "destOrgId" to choose the destination Org Id.
Copy Views
Added a new attribute "destOrgId" to choose the destination Org Id.
JSONArray of "sourceViewId" and "destViewId" is returned in the response.
Copy Formulas : Added a new attribute "destOrgId" to choose the destination Org Id.
Saveas View : Newly created viewid is returned in response.
2.0.0
C# Library
The C# client libraries wraps the raw HTTP based API of Zoho Analytics with easy to use methods for the C# .Net platform. This enables C# .Net developers to easily use Zoho Analytics API.
Environment Required: .NET Framework 4.5
csharpdocs
Click here for csharpdocs .
Download C# Client Library:
Download the C# client library (dll) based on ZohoAnalytics Server URI.
For 32 bit
For 64 bit
Add reference to your C# Projects using these .dll files. With this you will be able to perform Zoho Analytics API operations using the available functions.
Release Notes
2.1.0
Newly added APIs
Changes on existing APIs
Copy Workspace : Added a new attribute "destOrgId" to choose the destination Org Id.
Copy Views
Added a new attribute "destOrgId" to choose the destination Org Id.
List of "sourceViewId" and "destViewId" is returned in the response.
Copy Formulas : Added a new attribute "destOrgId" to choose the destination Org Id.
Saveas View : Newly created viewid is returned in response.
2.0.0
Python Library
The Python client libraries wraps the raw HTTP based API of Zoho Analytics with easy to use methods for Python language. This enables Python developers to easily use Zoho Analytics API.
Environment Required: Python 3.x
Pythondocs
Click here for pythondocs .
Download Python Client Library
Download the python client library based on your Data Centre.
Release Notes
2.1.0
Newly added APIs
Changes on existing APIs
Copy Workspace : Added a new attribute "dest_org_id" to choose the destination Org Id.
Copy Views
Added a new attribute "dest_org_id" to choose the destination Org Id.
List of "sourceViewId" and "destViewId" is returned in the response.
Copy Formulas : Added a new attribute "dest_org_id" to choose the destination Org Id.
Saveas View : Newly created viewid is returned in response.
2.0.0
PHP Library
The PHP client libraries wraps the raw HTTP based API of Zoho Analytics with easy to use methods for PHP language. This enables PHP developers to easily use Zoho Analytics API.
Environment Required: PHP 7.x
phpdocs
Click here for phpdocs .
Download php Client Library
Download the php client library based on your Data Centre.
Release Notes
2.1.0
Newly added APIs
Changes on existing APIs
Copy Workspace : Added a new attribute "$dest_org_id" to choose the destination Org Id.
Copy Views
Added a new attribute "$dest_org_id" to choose the destination Org Id.
Array of "sourceViewId" and "destViewId" is returned in the response.
Copy Formulas : Added a new attribute "$dest_org_id" to choose the destination Org Id.
Saveas View : Newly created viewid is returned in response.
2.0.0
GO Library
The GO client libraries wraps the raw HTTP based API of Zoho Analytics with easy to use methods for GO language. This enables GO developers to easily use Zoho Analytics API.
Environment Required: Go 1.12.x
godocs
Click here for godocs .
Download go Client Library
Download the go client library based on your Data Centre.
Steps to use go client
The below instructions helps to use Zoho Analytics Go Client Library in your Go application.
Download the Go Client Library from the above download link.
Extract the ZIP file.
Copy zoho/pkg/analyticsclient/analyticsclient.go to GO_PATH/src/ folder.
Go to zoho/pkg/analyticsclient folder.
Execute the below command:
You can use Zoho Analytics Client Library with the sample code provided in each API.
Release Notes
2.1.0
Newly added APIs
Changes on existing APIs
Copy Workspace : Added a new attribute "destorgid" to choose the destination Org Id.
Copy Views
Added a new attribute "destorgid" to choose the destination Org Id.
Array of "sourceViewId" and "destViewId" is returned in the response.
Copy Formulas : Added a new attribute "destorgid" to choose the destination Org Id.
Saveas View : Newly created viewid is returned in response.
2.0.0
NodeJS Library
The NodeJS client libraries wraps the raw HTTP based API of Zoho Analytics with easy to use methods for NodeJS language. This enables developers to easily use Zoho Analytics API.
Environment Required: Node v12.x
nodejs docs
Click here for nodejs docs .
Download Nodejs Client Library
Download the nodejs client library based on your Data Centre.
Release Notes
2.1.0
Newly added APIs
Changes on existing APIs
Copy Workspace : Added a new attribute "destOrgId" to choose the destination Org Id.
Copy Views
Added a new attribute "destOrgId" to choose the destination Org Id.
JSONArray of "sourceViewId" and "destViewId" is returned in the response.
Copy Formulas : Added a new attribute "destOrgId" to choose the destination Org Id.
Saveas View : Newly created viewid is returned in response.
2.0.0
Zoho CloudSQL
Zoho CloudSQL is a middleware technology that allows customers to interact with their business data stored in Zoho Analytics through familiar SQL language . Users can access the data in Zoho Analytics using SQL SELECT queries.
What is Zoho CloudSQL?
Zoho with its wide range of hosted productivity and business applications collects, mines and exposes a lot of structured and unstructured data to users. For developers working over the Zoho Platform, to extend and customize the various web services, it offers a comprehensive Web API over HTTPS for most of the Zoho Services. Currently Zoho Web API is the means to access and manipulate the data collected by the various Zoho services. But one drawback with the current Web API over HTTPS is the non-standard interface for querying and data manipulation, which could add up to the learning curve, adoption and maintenance.
Zoho CloudSQL is a platform API service that enables developers to use Standard SQL (Structured Query Language) querying over the Web, to access and manipulate data that is available in various Zoho Services in the Cloud (hence the name CloudSQL). SQL being a standard query language of Workspaces and data marts, it provides a much familiar and expressive development model for developers, thus making it easy to adopt and develop upon. With CloudSQL, Zoho Platform becomes first of its kind to offer full fledged standard SQL Querying over the Web.
Developers could execute SELECT, INSERT, UPDATE and DELETE SQL statements over the Web to handle the data in Zoho Services with CloudSQL. Another powerful facet of CloudSQL is the support for multiple SQL dialects which could be used by developers to construct their SQL queries. CloudSQL supports SQL queries written in any of ANSI, Oracle, Microsoft SQL Server, IBM DB2, MySQL, PostgreSQL and Informix dialects. This enables developers to easily adopt CloudSQL, if they are familiar in any one of the Workspace dialects mentioned.
Zoho Analytics and Zoho CloudSQL
Zoho Analytics , the online reporting and business intelligence service, is the first Zoho service to adopt Zoho CloudSQL. Developers could execute SQL SELECT statements over the web to handle the data in Zoho Analytics.
Key Highlights of Zoho Analytics CloudSQL Implementation
The key highlights of Zoho Analytics CloudSQL implementation are:
SQL querying over HTTPS
Currently it supports SELECT querying over HTTPS
INSERT, UPDATE and DELETE statements will be supported soon
Supports SQL Querying in multiple dialects including ANSI, Oracle, Microsoft SQL Server, IBM DB2, MySQL, Sybase, PostgreSQL and Informix dialects. Users can execute queries written in any of this dialects.
Enables application connectivity using Zoho Analytics JDBC driver to interact with the Zoho Analytics Service.
ODBC driver will be supported soon
SQL Query Entity Mapping
To construct and execute an SQL Query you need to first identify the entities on which the SQL Query will operate upon. The basic entities that are essential for constructing an SQL query includes Workspace, Tables and Columns.
The following section describes the mapping in Zoho Analytics that maps to these basic entities required for SQL querying. You need to use this mapping to construct your SQL queries for execution.
In Zoho Analytics the mapping of the entities would be the following:
SQL Query Entity
Zoho Analytics mapping
Workspace
Mapped to each Reporting Workspace in Zoho Analytics
Table
Mapped to Tables and Query Tables in a Reporting Workspace in Zoho Analytics
Column
Mapped to Columns of a Table or Query Table in a Reporting Workspace in Zoho Analytics
Sample:
Following is an example of a CloudSQL query executed on Zoho Analytics:
Entities involved in Zoho Analytics:
Workspace Name in Zoho Analytics : “Super Store Sales ”
Table Name : Sales
Columns Involved : Customer Name, Sales, Cost and Region
SQL SELECT Query:
select “Customer Name”,Sales,Cost,“Profit (Sales)” from Sales where Region = 'East’
The above query will fetch the records from the Sales table in Super Store Sales Workspace in Zoho Analytics, which are from the Region 'East’.
Zoho Analytics CloudSQL - API Specification
SQL Querying over HTTP using Zoho Analytics API
Zoho Analytics has implemented the Zoho CloudSQL technology as an extension to its HTTP Web API. Using the HTTP API, users can query Zoho Analytics Workspace by providing the SQL queries.
Currently Zoho Analytics supports only SQL SELECT Queries. Other SQL statements like INSERT, UPDATE and DELETE will be supported very soon.
Using SQL Select statements developers can fetch data from a single Table/Query Table or joining one or more tables in Zoho Analytics. The data can be fetched in different response formats, which includes CSV, PDF, HTML, JSON and XML
Zoho Analytics uses the Export Using Query action request to execute any SQL SELECT query given.
SQL Query:
The query should be passed as a value to the JSON attribue sqlQuery . The exact SQL Select query string should be URL encoded.
Sample Query:
The sample Select Query will fetch all the employees in the 'finance’ department along with their details in CSV Format.
Entities Involved:
Workspace Name: EmployeeDB
Tables Involved: Employee, EmpDetails
Select Query: (Note the query should be URL Encoded)
{"sqlQuery":"select empdet.Name Name,empdet.DOB Date_Of_Birth,empdet.Address Address,emp.BasicSal BasicPay,round(emp.BasicSal + emp.Allowance,2) Salary from Employee emp inner join EmpDetails empdet on emp.ID = empdet.ID where emp.Dept = 'Finance'"}
URL Encoded Select Query:
{"sqlQuery":"select%20empdet.Name%20Name%2Cempdet.DOB%20Date_Of_Birth%2Cempdet.Address%20Address%2Cemp.BasicSal%20BasicPay%2Cround%28emp.BasicSal%20%2B%20emp.Allowance%2C2%29%20Salary%20from%20Employee%20emp%20inner%20join%20EmpDetails%20empdet%20on%20emp.ID%20%3D%20empdet.ID%20where%20emp.Dept%20%3D%20%27Finance%27"}
Sample Success Response:
The sample response for the above query in CSV format is given below. The first row of the CSV response will contain the column names:
Name,Date_Of_Birth,Address,BasicPay,Salary
Akram,"10 Dec, 1979 00:00:00",california, $10,000 , $10,500
....
JDBC Driver for Zoho Analytics CloudSQL
Sample
The example Java code snippet shows how you can register Zoho Analytics CloudSQL JDBC driver, obtain a Connection , create a Statement and execute the query.
import java.sql.DriverManager ;
import java.sql.Connection ;
import java.sql.Statement ;
import java.sql.ResultSet ;
import java.sql.SQLException ;
import java.util.Properties ;
public class ZohoReportsCloudSQL
{
public static void main ( String args [])
{
Connection con = null ;
Statement stmt = null ;
ResultSet rs = null ;
try
{
Class . forName ( "com.zoho.cloudsql.jdbc.ZohoReportsDriver" );
Properties conProps = new Properties ();
// ZohoAnalytics admin emailaddress
conProps . put ( "user" , "david.s@zoho.com" );
// ZohoAnalytics OAuth authentication parameters
conProps . put ( "CLIENT_ID" , "" );
conProps . put ( "CLIENT_SECRET" , "" );
conProps . put ( "REFRESH_TOKEN" , "" );
// Uncomment this incase you need proxy settings
/*
// Proxy host name to connect the internet
conProps.put("PROXYSERVER","proxy_hostname");
// Proxy port to connect the internet
conProps.put("PROXYPORT","proxy_port");
// Proxy user name to connect the internet
conProps.put("PROXYUSERNAME","proxy_username");
// Proxy password to connect the internet
conProps.put("PROXYPASSWORD","proxy_password");
*/
/* Important Note: Connection is single threaded in Zoho Analytics */
// david.s@zoho.com is the admin of the Workspace 'Sales'
con = DriverManager . getConnection ( "https://analyticsapi.zoho.com/api/david.s@zoho.com/Sales" , conProps );
stmt = con . createStatement ();
String sql = "select * from <tablename>" ;
rs = stmt . executeQuery ( sql );
}
catch ( SQLException se )
{
// handle any errors
System . out . println ( "SQLException: " + se . getMessage ());
System . out . println ( "Zoho Analytics Error code: " + se . getErrorCode ());
}
catch ( Exception e )
{
// handle the exception
}
finally
{
if ( rs != null )
{
try
{
rs . close ();
}
catch ( SQLException sqlEx ) { } // ignore
}
if ( stmt != null )
{
try
{
stmt . close ();
}
catch ( SQLException sqlEx ) { } // ignore
}
if ( con != null )
{
try
{
con . close ();
}
catch ( SQLException sqlEx ) { } // ignore
}
}
}
}
CloudSQL enables users to execute SQL queries on structured data stored in Zoho Analytics, it also lends itself naturally to support Database Connectivity Standard like JDBC (Java Database Connectivity). Developers who are familiar using JDBC driver for connectivity to databases, can now use Zoho Analytics CloudSQL JDBC driver to connect and execute the necessary SQL queries.
With the availablity of this JDBC driver, developers need not learn the Zoho Analytics CloudSQL HTTP Web API to execute the SQL query. They just have know how to use the Zoho Analytics JDBC driver and start interacting with the service, the same way as they would interact with a Workspace using a JDBC standard driver.
Zoho Analytics JDBC Driver Download
Zoho Analytics JDBC Driver
JDBC Connection URL for Zoho Analytics
Sample
Jars to be kept in CLASSPATH for JDBC Driver
JDBC Type Mapping with Zoho Analytics Data types
Connecting Zoho Analytics from Workspace Visualization Tools
DBVisualizer
Squirrel SQL Client
Zoho Analytics JDBC Driver Download
Download the Zoho Analytics JDBC Driver from the below link.
https://css.zohostatic.com/analytics/jdbc/ZohoCloudSQLJDBC_1_0.zip
Javadocs
Zoho Analytics JDBC Driver
To use the JDBC Driver you need to have a zoho login email address and password. Currently you could only execute Select queries using the JDBC driver. Other SQL statements will be supported soon.
In JDBC, the DriverManager class manages the establishment of connections. DriverManager needs to be told which JDBC driver it should try to make connections with. The way to do this is to use Class.forName( ) on the class that implements java.sql.Driver interface.
Refer to the Zoho Analytics JDBC Driver javadocs to know more about the same. Click to download Zoho Analytics JDBC Driver .
JDBC Connection URL for Zoho Analytics
https://analyticsapi.zoho.com/api/<zoho_username_dbowner>/<Workspacename>
Sample
The sample code is shown in the code block.
Jars to be kept in CLASSPATH for JDBC Driver
All the jars from 'ZohoCloudSQLJDBC_1_0/Zoho/CloudSQLJDBCDriver/lib’ directory within the JDBC Driver Zip need to be kept in CLASSPATH for JDBC driver.
JDBC Type Mapping with Zoho Analytics Data types
The following table provides the mapping between the Zoho Analytics data types and the JDBC SQL types. Use this mapping to process the data fetched from Zoho Analytics in your Java code.
Zoho Analytics JDBC Driver supports connecting Zoho Analytics from the following Workspace Visualizations tools.
DbVisualizer tool
You can connect to Zoho Analytics from the DbVisualizer tool by following the steps below.
Step 1: Create a New Driver Name
Click Tools > Driver Manager from the toolbar menu. The Driver Manager dialog will open.
Select Driver > Create Driver
In the Driver Settings options, specify the name for the New Driver in the Name field (say, ZohoAnalyticsDriver)
In the URL Format field enter the URL in the format https://analyticsapi.zoho.com/api/<zoho_username_dbowner>/<Workspacename>
Provide the Driver Class name of Zoho Analytics JDBC driver (com.zoho.cloudsql.jdbc.ZohoReportsDriver) used for connecting Zoho Analytics.
In the Driver File Paths group option, on the User Specified tab click the File icon to add JAR files. Browse and add all relevant jar file for Zoho Analytics JDBC driver.
Close the wizard.
Step 2: Creating New Workspace Connection
Click Create new Workspace connection icon in Workspaces list window. It will prompt to select Use Wizard or No Wizard.
Choose Use Wizard option. New Connection Wizard will open.
Enter the connection alias name for the new Workspace connection and then click Next .
Select the appropriate Workspace driver (ZohoAnalytics Driver) from the drop down and then click Next button.
In the Database URL field, specify the URL of the Workspace to be connected as follow. Format: https://analyticsapi.zoho.com/api/<zoho_username_dbowner>/<Workspacename> Example: https://analyticsapi.zoho.com/api/david.s@zoho.com/Sales
Click Finish to create the new connection.
On Properties > Driver Properties , enter OAuth authentication parameters (CLIENT_ID,CLIENT_SECRET and REFRESH_TOKEN) and click Apply.
Finally from Connection , click Connect
Connections Overview
The Connection Overview will list all the Workspace connections configured in the tool, on selecting the connections object in the Workspaces Objects Tree. To connect to your Zoho Analytics account, double click Zoho Analytics connection. All the Workspaces in your account along with the table will be listed.
Executing a SQL SELECT Query
Follow the below steps to execute a SQL SELECT query in your Zoho Analytics Workspace.
Click Create a new SQL commander tab icon from the toolbar.
Choose Workspace name from the Workspace drop down.
Specify SQL SELECT Query in QUERY area and run the query.
Only SQL SELECT queries can be used to access Zoho Analytics from the tool.
Squirrel SQL Client
You can also connect to Zoho Analytics from the Squirrel SQL client . To connect to a Zoho Analytics Workspace from Squirrel SQL client, you need to provide two sets of information i.e., the driver definition and the alias. The driver definition specifies the JDBC driver to use and the alias specifies the connection parameters.
Steps for Creating New Driver Definition
Create a new driver definition to specify the JDBC driver by following the steps below.
Click Windows > View Drivers from the toolbar menu.
Click the Create a New Driver (+) icon in the driver List window. The Add Driver wizard will open.
Specify the Name for the driver in the Name field (say, ZohoAnalyticsDriver).
In the Example URL field, enter the URL format https://analyticsapi.zoho.com/api/<zoho_username_dbowner>/<Workspacename>
Open Extra Class Path tab and click Add . You will find option to add JAR files.
To ensure it is added properly, click the List Drivers button. The class name found in the class path of the Zoho Report’s JDBC driver will be listed in the Class Name drop down.
Click OK .
Steps for Adding Alias
Alias holds all configurations to connect to a Workspace. Create new alias for Zoho Analytics to specify the connection parameters by following the steps below.
Click Aliases from the toolbar menu.
Click the Create a New Alias (+) icon in the Aliases List window. The Add Alias wizard will open.
Specify the alias name for the Workspace connection in the Name field.
Select the driver for this alias from the Driver drop down.
In the URL field, specify the URL of the Workspace to be connected as follow. Format: https://analyticsapi.zoho.com/api/<zoho_username_dbowner>/<Workspacename> Sample: https://analyticsapi.zoho.com/api/david.s@zoho.com/Sales
Select Properties > Driver Properties .
Select Use Driver Properties checkbox and provide the required OAuth authentication parameters(CLIENT_ID,CLIENT_SECRET and REFRESH_TOKEN) and click OK to save the driver properties.
Click OK to save the alias definition.
Connecting to Zoho Analytics Workspace
Follow the steps below to connect to a Workspace in Zoho Analytics
The newly created alias will be listed in the Aliases List Window. Right-click on alias Name and then click Connect .
The connection will be established to your Zoho Analytics account and the Object Tree will display the structure of the reporting Workspace in Zoho Analytics.
Executing a SQL SELECT Query
SQL SELECT Query can be executed from the SQL tab as said below.
Open the SQL tab.
Specify the required SQL SELECT query to execute in your Zoho Analytics Workspace.
Click Run SQL icon in the session Window toolbar to execute the query.>
Only SQL SELECT queries can be executed in Zoho Analytics from the tool.
CloudSQL Client Libraries
To enable developers to easily use the Zoho Analytics CloudSQL HTTP API, we have provided Client libraries in the below given programming languages.
CSharp Client Library
GO Client Library
Java Client Library
PHP Client Library
Python Client Library
NodeJS Client Library
C# Client Library
C# client library wraps the HTTP API of Zoho Analytics with the easy to use methods in C# .Net programming language.
Sample code snippet for using CloudSQL with C# client API:
IAnalyticsClient ac = new AnalyticsClient(clientId, clientSecret, refreshToken);
string responseFormat = "csv";
String sqlQuery = "select * from Sales";
IBulkAPI data = ac.GetBulkInstance(orgId, workspaceId);
long jobId = data.InitiateBulkExportUsingSQL(sqlQuery, responseFormat, null);
Console.WriteLine(jobId);
For more details on C# client libraries, kindly view this link .
Go Client Library
Go client library wraps the HTTP API of Zoho Analytics with the easy to use methods in Go language.
Sample code snippet for using CloudSQL with Go client API:
ac := ZAnalytics.GetAnalyticsClient(clientId, clientSecret, refreshToken)
config := map[string]interface{}{}
sqlquery := "select * from Sales"
responseformat := "csv"
bulk := ZAnalytics.GetBulkInstance(&ac, orgId, workspaceId)
result, err := bulk.InitiateBulkExportUsingSQL(sqlquery, responseformat, config)
fmt.Println(result)
For more details on Go client libraries, view this link
Java Client Library
Java client library wraps the HTTP API of Zoho Analytics with the easy to use methods in Java language.
Sample code snippet for using CloudSQL with Java client API:
AnalyticsClient ac = new AnalyticsClient(clientId, clientSecret, refreshToken);
String sqlQuery = "select * from Sales";
String responseFormat = "csv";
BulkAPI bulk = ac.getBulkInstance(orgId, workspaceId);
long jobId = bulk.initiateBulkExportUsingSQL(sqlQuery, responseFormat, null);
System.out.println(jobId);
For more details on Java client libraries, view this link
PHP Client Library
PHP client library wraps the HTTP API of Zoho Analytics with the easy to use methods in PHP language.
Sample code snippet for using CloudSQL with PHP client API:
$this->ac = new AnalyticsClient($this->client_id, $this->client_secret, $this->refresh_token);
$sql_query = "select * from Sales";
$response_format = "csv";
$bulk = $this->ac->getBulkInstance($this->org_id, $this->workspace_id);
$response = $bulk->initiateBulkExportUsingSQL($sql_query, $response_format);
print_r($response);
For more details on PHP client libraries, view this link
Python Client Library
Python Client Library wraps the HTTP API of Zoho Analytics with the easy to use methods in Python language.
Sample code snippet for using CloudSQL with Python client API:
ac = AnalyticsClient(Config.CLIENTID, Config.CLIENTSECRET, Config.REFRESHTOKEN)
response_format = "CSV"
sql_query = "select * from Sales where Region='East'"
bulk = ac.get_bulk_instance(Config.ORGID, Config.WORKSPACEID)
result = bulk.initiate_bulk_export_using_sql(sql_query, response_format)
print(result)
For more details on Python client libraries, kindly view this link
NodeJS Client Library
NodeJS Client Library wraps the HTTP API of Zoho Analytics with the easy to use methods in NodeJS language.
Sample code snippet for using CloudSQL with NodeJS client API:
var ac = new analyticsClient(clientId, clientSecret, refreshtoken);
var config = {};
var responseFormat = 'csv';
var sqlQuery = 'select * from Sales';
var bulk = ac.getBulkInstance(orgId, workspaceId);
bulk.initiateBulkExportUsingSQL(sqlQuery, responseFormat).then((response) => {
console.log(response);
});
For more details on NodeJS client libraries, kindly view this link
Supported SQL
User can provide SQL SELECT queries in any of the below given Workspace SQL dialects. Follow the links to know more about the SQL statements and functions, in each given Workspace dialect, supported by Zoho Analytics CloudSQL implementation.
ANSI SQL
Oracle
SQL Server
MySQL
DB2
Sybase
Informix
PostgreSQL
Zoho Analytics supports following SELECT query syntax and in-built functions in CloudSQL.
Supported SELECT Query Syntax:
Following are the conventions used in the SELECT syntax definition:
CONVENTIONS
MEANING
EXAMPLE
Square Brackets [ ]
Indicates that the enclosed arguments are optional in the syntax
DIGITS [. PRECISION ]
Braces followed by plus sign ( )+
Indicates that the enclosed arguments can occur more than once
( DIGIT )+
Braces followed by star sign ( )*
Indicates that the enclosed arguments can occur zero or more times
SELECT column_name ( , column_name)* FROM table_name
Question Mark ?
Indicates that the Question mark “?” preceded by an argument is optional. Equivalent to Square Brackets[ ]
<INTEGER> ( "." <INTEGER> )?
Vectical Line
Vertical Line indicates choices
(DISTINCT
UPPER CASE
Uppercase text indicates case-insensitive filenames or directory names, commands, command keywords, initializing parameters, data types.
SELECT column_name FROM table_name
lower case
Lowercase text indicates Workspace objects like table name, column names etc.
DELETE FROM table_name WHERE condition
SELECT Syntax:
SELECT [ DISTINCT | ALL ] ( ( column_clause ( "," column_clause )* ) | "*" ) [ FROM table_expression_clause ]
[ where_clause ] [ group_by_clause ] [ having_clause ] [ order_by_clause ] [ limit_clause ]
column_clause : ( expression | table_name.* | table_name.columnname | table_name.column_name | column_name ) [ [ AS ] alias_name ]
table_expression_clause : ( table_name ) [ AS alias_name ] ( "," ( table_name ) [ AS alias_name ])*
where_clause : WHERE (<Left Where Expression>(= | < | > | <= | >= | != | LIKE | NOT LIKE | BETWEEN) <Right Where Expression>) ( (OPERATOR ) (<Left Where Expression> (= | < | > | <= | >= | != | LIKE | NOT LIKE | BETWEEN) <Right Where Expression>)* OPERATOR includes AND/OR
group_by_clause : GROUP BY expression ( "," expression )*
having_clause : HAVING condition
order_by_clause : ORDER BY (order_item_clause) ( "," order_item_clause )*
limit_clause : LIMIT (value | ALL) [ "," value ]
join_clause : table_name INNER JOIN table_name ON join_condition | <br> table_name {LEFT | RIGHT} [OUTER] JOIN table_name ON join_condition
order_item_clause : (expression | column name) [ ASC | DESC ]
UNION Syntax:
<SELECT Query Statement> (UNION [ALL | DISTINCT] <SELECT Query Statement>)+
Reference: MySQL SELECT Query syntax documentation
MySQL STRING FUNCTIONS
The MySQL in-built String functions supported by Zoho Analytics.
ASCII(string_arg):
Purpose:
The ASCII value of the first character of the given argument is returned.
Example:
Select ascii('ant’) returns '97’
Note:
Returns '0’ if argument is null.
The first character of the string can be any alphabet, number, symbol or special character.
BIN(numeric_arg):
Purpose:
Returns the binary value of the given argument.
Example:
Select BIN('40’) returns '101000’
Note:
Returns null if argument is null.
Returns 0 if argument is any non-numeric character.
BIT_LENGTH(string_arg):
Purpose:
Returns the value of the length of the string argument in bits.
Example:
Select BIT_LENGTH('AA’) returns '16’
Note:
The argument can consist of any numeric,alphabetic or special character.
Returns 0 if argument is null.
CHAR(numeric_arg1, numeric_arg2, numeric_arg3,….):
Purpose:
Returns a String of characters formed from the code values of the ASCII code given in the arguments.
Example:
Select CHAR (97.4,97.5) returns 'ab’ Select CHAR ('97’,'X’,'98’) returns 'a b’ // Returns space for each non-numeric character in the argument.
Note:
Returns null if argument is null.
If the given ASCII is in decimals, then it returns the value of the closest whole number.
If the given ASCII is in decimals but is given as a string then the number after the decimal point is ignored and the code value of the number before the decimal alone is returned.
CHAR_LENGTH(string_arg):
Purpose:
Returns the number of characters present in the argument.
Example:
Select CHAR_LENGTH('aa1’) returns '3’
Note:
The argument can consist of any numeric,alphabetic or special characters.
Returns 0 if argument is null.
Multibyte characters are counted as a single character.
CHARACTER_LENGTH(string_arg):
Purpose:
Returns the number of characters present in the argument.
Example:
Select CHARACTER_LENGTH('aa1’) returns '3’
Note:
The argument can consist of any numeric,alphabetic or special characters.
Returns 0 if argument is null.
Multibyte characters are counted as a single character.
CONCAT(string_arg1, string_arg2, string_arg3,…):
Purpose:
Returns the concatenated string of the arguments.
Example:
Select CONCAT('red’,'rose’) returns ’ redrose’
Note:
The arguments can consist of any number,alphabet or special characters.
Returns null if all arguments are null.
Returns the non-null argument string if atleast one argument is not null and the rest of the arguments are null..
CONCAT_WS(char_arg, string_arg1, string_arg2,…):
Purpose:
Returns the concatenated string of the arguments with the first argument acting as the separator between the concatenated strings.
Example:
Select CONCAT_WS (’,’,'red’,'rose’,'is’,'beautiful’) returns 'red,rose,is,beautiful’
Note:
The arguments can consist of any number,alphabet or special characters.
Returns null if all arguments are null.
The separator can be any symbol, letter, string, or number.
If the first argument is null, Returns the concatenated string of the rest of the arguments .
If the first argument is non-null and the rest of the arguments are null then the separator is returned concatenated with itself (n-1) times, if 'n’ is the number of arguments.
ELT(numeric_arg, string_arg1, string_arg2,…):
Purpose:
The value of the first argument gives the count of the argument to be returned from the rest of the arguments.
Example:
Select ELT ('2’,'red’,'rose’,'is’,'beautiful’) returns 'rose’
Note:
The count of the argument to be returned is started from the second argument.
Returns null if first argument is null or the number of arguments is less than the count.
If the first argument is a non numeric character, then null is returned.
FIELD(string_arg, string_arg1, string_arg2,…):
Purpose:
The first argument string is checked with all the other arguments and the position of the argument where the first match is found is returned.
Example:
Select FIELD ('as’,'has’,'as’,'have’) returns '2’
Note:
The position of the arguments starts from the second argument.
If the first argument or the rest of the arguments are null then '0’ is returned.
Returns '0’ if no match is found.
FIND_IN_SET(string_arg1, string(element1,element2,…)):
Purpose:
The first argument string is checked with the second argument, which is a set of strings separated by commas, and the position of the first match in the set is returned.
Example:
Select FIND_IN_SET ('10’,'2,5,8,10’) returns '4’
Note:
If either the first or the second argument is null, then '0’ is returned.
If both the first and the second argument are null, then 'null’ is returned.
Purpose:
Rounds off the number given in the first argument to the number of decimals given in the second argument.
Example:
SELECT FORMAT (1.0001111,5) returns '1.00011’
Note:
If the second argument is 0 then there are no decimal value or decimal point in the returned number.
If the number has no decimals then zeros are appended to the number after the decimal point.
HEX(string_arg):
Purpose:
Returns the corresponding hexadecimal number for each character of the given string.
Example:
Select HEX('255’) returns '323535’
Note:
If the given argument is null then null is returned.
If the given argument is given as a number then the hexadecimal number of the number as a whole is returned.
INSTR(string_arg, string_arg):
Purpose:
Returns the position of the first match of second string argument in the first argument.
Example:
Select INSTR ('impossible’,'possible’) returns '3’
Note:
If both the arguments are null then '1’ is returned.
If the second argument alone is null then '1’ is returned.
If the first argument alone is null then '0’ is returned.
If the second argument does not match with the first string then '0’ is returned
LEFT(string_arg, numeric_arg):
Purpose:
From the first argument string the number of characters as that passed in the second argument is returned.
Example:
Select LEFT ('select’,'3’) returns 'sel’
Note:
If null, '0’ or any non numeric character is passed in the second argument then null is returned.
If the value of the second argument exceeds that of the first argument string then only the first argument string is fully returned
LENGTH(string_arg):
Purpose:
Returns the total number of bytes present in the string. The multibyte characters are counted as multiple bytes.
Example:
Select LENGTH ('advent123!$’) returns '11’
Note:
Returns 0 if the argument is null
LOCATE(string_arg):
Purpose:
Returns the position of the first string argument in the second string argument.
Example:
Select LOCATE ('net’,'adventnet’) returns '7’
Note:
Returns 0 if the first argument is not present in the second argument.
Returns '0’ if the second argument is null.
Returns 1 if the first argument is null.
Returns 1 if both the arguments are null.
LPAD(string_arg, numeric_arg, string_arg):
Purpose:
The third argument is prepended to the left of the first argument until the length given in the second argument is attained.
Example:
Select LPAD ('brother’,'9’,'hello’) returns 'hebrother’
Note:
If the total length of the resultant string is more than the length to be attained, then the third string argument is cut off as the required length is attained.
Returns null if the third argument is null.
Returns null if the second argument is '0’ or null.
If the length of the first argument exceeds the given count then the first argument is cut off upto the required result.
If the total length of the resultant string is less than the length to be attained, then the third string argument is repeated till the required length is attained.
LTRIM(string_arg):
Purpose:
Returns the argument with the blank spaces at the prefix of the string removed.
Example:
Select LTRIM (’ ab cd’) returns 'ab cd’
Note:
The space between the characters are not affected.
MAKE_SET(numeric_arg, string_arg1, string_arg2,…):
Purpose:
For the given bit in the first argument, the corresponding 'set’ of arguments from the remaining arguments is returned.
Example:
Select MAKE_SET (3,'ab’,'cd’,'ef’) returns 'ab,cd’
Note:
Returns null if the first argument is null or 0.
ORD(string_arg):
Purpose:
If the first character of the string argument is a multi-byte character, then the code calculated from the below formula is returned. 1st byte code + (2nd byte code * 256) + (3rd byte code * 256 * 256) + …
REPEAT(string_arg, numeric_arg):
Purpose:
The first string argument is returned repeatedly the number of times as that given in the second argument.
Example:
Select Repeat ('AA’,5) returns 'AAAAAAAAAA’
Note:
Returns null if either or both the first argument and the second argument are null.
REPLACE(string_arg, string_arg, string_arg):
Purpose:
Replaces the string given in the second argument with the string given in the third argument from the first argument string.
Example:
select replace('tention’,'ten’,'celebra’) returns 'celebration’
Note:
Returns the first argument string if the second argument is null.
If the third argument is null, Returns the first argument string with the second argument string removed from it.
If the second and third argument are null then the first argument string is returned.
REVERSE(string_arg):
Purpose:
Returns the string argument in the reversed order of characters.
Example:
select reverse ('main’) returns 'niam’
Note:
Returns null if the argument is null.
RIGHT(string_arg, numeric arg):
Purpose:
For the count passed in the second argument the first argument’s characters from the right end is returned.
Example:
select RIGHT ('adventnet’,3) returns 'net’
Note:
Returns null if either or both the first and second arguments are null.
RPAD(string_arg, numeric arg, string_arg):
Purpose:
The third argument is appended to the right of the first argument until the length of the second argument is acheived.
Example:
select RPAD ('abcdef’,10,'ghijkl’) returns 'abcdefghij’
Note:
If the total length of the resultant string is more than the length to be attained, then the resultant argument string is cut off as soon as the required length is attained.
Returns null if either the second or the third argument is null.
If the total length of the resultant string is less than the length to be attained, then the third string argument is repeated till the required length is attained.
Returns the repeated third argument if the first argument is null.
RTRIM(string_args):
Purpose:
Returns the argument with the blank spaces at the suffix of the string removed.
Example:
Select rtrim ('abcd ’) returns 'abcd’
Note:
Returns null if the argument is null.
SOUNDEX(string_arg):
Purpose:
Returns the soundex string of the given argument. The soundex string is similar for same sounding strings.
Example:
Both Select soundex ('bye’) and Select soundex ('boy’) return 'b000’
SPACE(numeric_arg):
Purpose:
The argument value is returned as the number of space characters.
Example:
Select space(6) returns ’ ’
Note:
Returns null for non-numeric and negative arguments.
SUBSTRING(string_arg, numeric_arg):
Purpose:
Returns the substring formed by cutting off the string argument passed according to the needs.
Example:
Select substring ('adventnet’,7) returns 'net’
Select substring ('adventnet’ From 3) returns 'ventnet’
Select substring ('adventnet’, 3,4 ) returns 'vent’
Select substring ('adventnet’, -3) returns 'net’
<> Select substring ('adventnet’, -7,4) returns 'vent’
Note:
Returns null when the numeric argument exceeds or is less than the length of the string argument.
SUBSTRING_INDEX(string_arg, string_arg, numeric_arg):
Purpose:
The second argument acts as the delimiter and the third argument is the count number. As soon as the match of the delimiter is found for the correct count in the first argument string, the rest of the string is cut off.
Example:
select substring_index ('how.are.you’, ’.’, 2) returns 'how.are’ // for positive count, limitation is done to the right of the delimiter. select substring_index ('how.are.you’, ’.’, -2) returns 'are.you’ // for negative count, limitation is done to the left of the delimiter
Note:
If the count is null, zero or any non-numeric character then null is returned.
If the count is greater than the number of delimiters present in the string then the given string is returned without any change made to it.
TRIM(string_arg):
Purpose:
For the given specifiers the string argument is trimmed accordingly.
Example:
Select TRIM (’ zoho ’) returns 'zoho’ // if no specifier is given, spaces before and after the string are trimmed Select TRIM (leading ’!’ from ’!!!!zoho!!!!’) returns 'zoho!!!!’ // if leading specifier is given then the prefix part is trimmed Select TRIM (trailing ’!’ from ’!!!!zoho!!!!’) returns ’!!!!zoho’ // if trailing specifier is given then the suffix part is trimmed.
UNHEX(string_arg):
Purpose:
Returns the corresponding character for each pair of hexadecimal digits.
Example:
Select unhex('21’) returns ’!’
Note:
Returns null when the argument value is a non hexadecimal number.
UPPER(string_arg):
Purpose:
Returns the argument string with all its alphabetic characters in Upper Case.
Example:
select upper ('AdVeNt’) returns 'ADVENT’
Note:
The numeric and symbolic characters remain unchanged.
MySQL MATHEMATICAL FUNCTIONS
The MySQL in-built Math functions supported by Zoho Analytics
ABS(numeric_arg):
Purpose:
Returns the numerical value of a number given in the argument without regard of its sign.
Example:
Select ABS (-23) returns '23’
Select ABS (’-23’) returns '23.0’ // If a number is passed as a string then the number is returned in decimal form.
Select ABS (’-23B0011’) returns '23.0’ // As soon as a non numeric character is found in the number string the number is returned in decimal form.
Note:
Returns '0.0’ for non-numeric string arguments.
Returns '0.0’ for null arguments.
ACOS(numeric_arg):
Purpose:
Returns the Inverse Cosine value of the argument passed. The argument’s value should be between -1 to 1.
Example:
Select ACOS (0.5) returns '1.0471975511966’ Select ACOS ('0.5A@5’) returns '1.0471975511966’ // As soon as a non numeric character is found in the number string the number value is returned.
Note:
Returns the value of Acos(0) i.e '1.5707963267949’ for null argument.
Returns the value of Acos(0) i.e '1.5707963267949’ for non numeric argument.
Returns null if the numeric argument value is out of range.
ASIN(numeric_arg):
Purpose:
Returns the Inverse Sine value of the argument passed. The argument’s value shuld be between -1 to 1.
Example:
Select ASIN (0.5) returns '0.5235987755983’ Select ASIN ('0.5A@5’) returns '0.5235987755983’ // As soon as a non numeric character is found in the number string the number’s value is returned.
Note:
Returns '0.0’ for null argument.
Returns '0.0’ for non numeric argument.
Returns null if the numeric argument value is out of range.
ATAN(numeric_arg):
Purpose:
Returns the Inverse Tangent value of the argument passed.
Example:
Select ATAN (0.5) returns '0.46364760900081’ Select ATAN ('0.5A@5’) returns '0.46364760900081’ // As soon as a non numeric character is found in the number string the number’s value is returned.
Note:
Returns '0.0’ for null argument.
Returns '0.0’ for non numeric argument.
A negative number’s ATAN value is equal to the ATAN value of its positive number but with a minus sign.
ATAN2(numeric_arg):
Purpose:
Returns the number of characters present in the argument.
Example:
Select ATAN2 (2,4) returns '0.46364760900081’ Select ATAN2 ('0.5A’) returns '0.46364760900081’ // As soon as a non numeric character is found in the number string the number’s value is returned.
Note:
Returns '0.0’ if one argument is null and the other argument is a non numeric number.
Returns '0.0’ if both the arguments are null or zero.
Returns '1.5707963267949’ when the second argument is '0’ and the first argument is any natural number.
Returns '0.0’ when the second argument is '0’ and the first argument is any non-numeric character and vice versa.
CEIL(numeric_arg):
Purpose:
The smallest integer that is greater than or equal to the value of the argument is returned.
Example:
Select CEIL (1.5) returns '2’
Note:
Returns '0’ if argument is null or any non-numeric character.
As soon as a non numeric character is found in the number string argument, the CEILING of the number value is returned and the rest of the argument characters are neglected.
CEILING(numeric_arg):
Purpose:
The smallest integer that is greater than or equal to the value of the argument is returned.
Example:
Select CEILING (1.5) returns '2’
Note:
Returns '0’ if argument is null or any non-numeric character.
As soon as a non numeric character is found in the number string argument, the CEILING of the number value is returned and the rest of the argument characters are neglected.
CONV(string_arg, numeric_arg1, numeric_arg2):
Purpose:
Changes the argument number string from the given base to the required base. The first argument is the given number string, the second argument is the original base of the number and the third argument is the base to which the number string is to be converted.
Example:
Select CONV ('F’,16,10) returns '15’
Note:
Returns null if any of the arguments is null.
Returns '0’ if the bases given in the second or third arguments are non-compatible with the number.
The maximum value of the bases is 36 and the minimum value is 2.
COS(numeric_arg):
Purpose:
Returns the COSINE value of the argument passed. The value of the arguments should be in radians.
Example:
Select COS (45) returns '0.52532198881773’
Note:
Returns '1.0’ if the argument is null, zero or any non-numeric string.
COT(numeric_arg):
Purpose:
Returns the COTANGENT value of the argument passed.
Example:
Select COT() returns “
Note:
Returns null if the argument is null, zero or any non-numeric string.
CRC32(numeric_arg):
Purpose:
Returns a 32 bit unsigned output after calculating the cyclic redundancy check.
Example:
Select CRC32 ('111’) returns '1298878781’
Note:
Returns '0’ if the argument is null.
The argument should be a string. Numbers are also taken as strings
DEGREES(numeric_arg):
Purpose:
The argument’s value is converted from radians to degrees.
Example:
Select DEGREES (3.141593) returns '180’
Note:
Returns null if the argument is zero, null or a non-numeric string.
EXP(numeric_arg):
Purpose:
The value of 'e’ raised to the power of the given number argument is returned.
Example:
Select EXP (6) returns '403.42879349274’
Note:
Returns '1.0’ when zero, null or any non-numeric number is passed in the argument.
FLOOR(numeric_arg):
Purpose:
The largest integer that is smaller than or equal to the value of the argument is returned.
Example:
Select FLOOR (1.5) returns '1’
Note:
Returns '0’ if argument is null or any non-numeric character.
As soon as a non numeric character is found in the number string argument, the FLOOR of the number value is returned and the rest of the argument characters are neglected.
Purpose:
Rounds off the number given in the first argument to the number of decimals given in the second argument.
Example:
SELECT FORMAT (1.0001111,5) returns '1.00011’
Note:
If the second argument is 0 then there are no decimal value or decimal point in the returned number.
If the number has no decimals then zeros are appended to the number after the decimal point.
LN(numeric_arg):
Purpose:
Returns the natural logarithmic value of the given argument.
Example:
Select LN('123’) returns '4.8121843553724’
Note:
Returns null if the argument is null, negative or any non-numeric character.
As soon as a non numeric character is found in the number string argument, the LN of the number value is returned and the rest of the argument characters are neglected.
LOG(number1, number2):
Purpose:
Performs the same function as LN for single parameter. For 2 parameters, the first argument is the base and the second argument is the number. The logarithm of the number to the base is returned.
Example:
Select LOG(10,100) returns 2.0
Note:
Only numbers are accepted. Numbers given as strings are also not accepted.
LOG2(numeric_arg):
Purpose:
The logarithm of the number to the base 2 is returned.
Example:
Select LOG2 (100) returns '6.6438561897747’
Note:
Returns null if the argument is null, negative or any non-numeric charecter.
Numbers given as strings are also accepted.
As soon as a non numeric character is found in the number string argument, the LOG2 of the number is returned and the rest of the argument characters are neglected.
LOG10(numeric_arg):
Purpose:
The logarithm of the number to the base 10 is returned.
Example:
Select LOG10 (100) returns '2.0’
Note:
Returns null if the argument is null, negative or any non-numeric character.
Numbers given as strings are also accepted.
As soon as a non numeric character is found in the number string argument, the LOG10 of the number is returned and the rest of the argument characters are neglected.
MOD(numeric_arg,numeric_arg):
Purpose:
The first argument is the dividend and the second argument is the divisor. The remainder of the division is returned.
Example:
Select MOD (99,8) returns '3’ Select 99 mod 8 returns '3’ Select 99 % 8 returns '3’
Note:
Returns '0.0’ if the first argument is null and the second argument is any number.
Returns null if the second argument is null irrespective of the first argument.
OCT(numeric_arg):
Purpose:
Returns the octal value of the number given in the argument.
Example:
Select OCT (12) returns '14’.
Note:
Returns '0’ if the argument is null or non-numeric character string.
As soon as a non numeric character is found in the number string argument, the OCT of the number is returned and the rest of the argument characters are neglected.
PI():
Purpose:
The value of ¶ (pi), ie 22 / 7 is returned. Only 6 numbers after the decimal point is returned by default.
Example:
Select PI () returns '3.141593’
POW(numeric_arg, numeric_arg):
Purpose:
The first argument is a number and the second argument is the power to which the given number is to be raised. The value of the number raised to the required power is returned.
Example:
Select POW (3,4) returns '81.0’
Note:
If the second argument is zero, null or any non-numeric string then irrespective of the value and type of first argument '1.0’ is returned .
RADIANS(numeric_arg):
Purpose:
The argument’s value is converted from degree to radians.
Example:
Select RADIANS ( 180) returns '3.1415926535898’
Note:
Returns '0.0’ for any non-numeric string argument.
As soon as a non numeric character is found in the number string argument, the RADIANS of the number is returned and the rest of the argument characters are neglected.
RAND(numeric_arg):
Purpose:
A random value between the range of 0 and 1 is returned for the given argument.
Example:
Select RAND (3) returns '0.90576975597606’
Note:
Returns '0.15522042769494’ if the argument is zero, null or any non-numeric string.
ROUND(numeric_arg):
Purpose:
Returns the rounded value of the given decimal number.
Example:
Select ROUND (23.248) returns '23’ Select ROUND (23.248, 1) returns '23.4’ // Rounds off the given number’s decimals upto the number given in the second argument. Select ROUND (23.248,-1) returns '20.0’
Note:
If the second argument is null or any non-numeric string, then the given number is rounded off assuming the value of second argument as zero.
SIGN(numeric_arg):
Purpose:
Depending on the sign of the argument, -1 is returned for negative number, 0 is returned for zero and 1 is returned for positive number.
Example:
Select SIGN (-200) returns ’-1’ Select SIGN (200) returns '1’ Select SIGN (-0) returns '0’ / returns '0’ irrespective of the sign before 0 .
Note:
Returns '0’ if the given argument is a non-numeric string.
If a string has numbers followed by characters then the sign of the number is returned.
SIN(numeric_arg):
Purpose:
Returns the SINE value of the argument passed. The value of the arguments should be in radians
Example:
Select SIN ( 111) returns '0.86455144861061’
Note:
Returns '0.0’ for null and non-numeric arguments.
As soon as a non numeric character is found in the number string the number’s SIN value is returned.
SQRT(numeric_arg):
Purpose:
Returns the square root value of the given number.
Example:
Select SQRT ('2’) returns '1.4142135623731’
Note:
Returns null for non numeric string arguments.
Returns '0.0’ for negative numbers.
Returns the SQRT of the number alone when a number is followed by a non-numeric string.
TAN(numeric_arg):
Purpose:
Returns the TAN value of the argument passed. The value of the arguments should be in radians.
Example:
Select TAN ( '111’) returns '1.7203486651304’
Note:
Returns '0.0’ for non-numeric or null arguments.
For negative numbers, the TAN of the argument’s absolute value is found and a minus sign is added at the beginning.
TRUNCATE(string_arg):
Purpose:
The first argument is the given decimal number and the second argument is the number that decides upto which the given number’s decimals are to be truncated. The truncated number is returned.
Example:
Select TRUNCATE (234.56789,2) returns '234.56’ Select TRUNCATE (234.56789,’-2’) returns '200.0’
Note:
Truncates all the decimals if the second argument is null, zero or any non-numeric string.
MySQL DATE FUNCTIONS
The MySQL in-built Date Time functions supported by Zoho Analytics.
ADDDATE(date_arg, numeric_arg):
Purpose:
The first argument is a date value and the second argument is the number of days to be added to it. Returns the new date.
Example:
Select ADDDATE ( ’ 2008-08-03 ’ , 20 )
Note:
The interval to be added should be in numeric value only and should not be in the form of 'INTERVAL 31 DAYS’.
ADDTIME(time_arg, time_arg):
Purpose:
The addition value of first argument time and second argument time is returned.
Example:
Select ADDTIME ('12:30:15.55555555’, '01:00:44.444445’) returns '13:31:00.000000’
CONVERT_TZ(datetime_arg, time_arg, time_arg):
Purpose:
Converts the given time value to the required time value by adding the time given in the third argument.The resultant time value comes in 12 hour or 24 hour format depending on the second argument.
Example:
Select CONVERT_TZ ( ’ 2008-11-06 03:00:00 ’ , ’ +09:00 ’ , ’ -5:30 ’ ) returns ’ 2008-11-05 12:30:00 ’
Note:
For the result to be in 12 hour format, the second argument should be '12:00’
For the result to be in 24 hour format, the second argument should be '00:00’
CURDATE():
Purpose:
The present date is returned in the format of ’ yr:mth:dt ’.
Example:
Select CURDATE () returns '2008-11-06’
Note:
Depending on the way the function is used the result is returned as a string or a number.
CURRENT_DATE():
Purpose:
Its function is the same as CURDATE()
CURRENT_TIME():
Purpose:
Its function is the same as CURTIME()
CURTIME():
Purpose:
Returns the present time of the system in the form of ’ hr : min : sec ’.
Example:
Select CURTIME() returns ’ 12 : 46 : 21 ’ Select CURTIME()+0 returns ’ 124621.0 ’
Note:
Depending on its usage the function returns the result as a string or a number.
DATE(date.time_arg):
Purpose:
Returns the date part alone from the date-time argument given in the function.
Example:
Select DATE ( ’ 2008-08-03 03:45:00 ’ ) returns ’ 2008-08-03 ’
Note:
Returns null if the date part is non-numeric.
Returns the date part correctly even if the time part is non-numeric.
DATEDIFF(date.time_arg, date.time_arg):
Purpose:
Returns the difference between the 2 dates given in the arguments. For subtraction only the date part of the date-time values of both the argument is taken.
Example:
Select DATEDIFF ( '1986-08-03 03:45:22’,'1986-08-23 18:45:43’) returns ’-20’
Note:
The time part is not taken in the calculation. Hence even if the time part is non-numeric no difference to the result takes place.
DAYNAME(date_arg):
Purpose:
Returns the day of the week the given date is .
Example:
Select DAYNAME ( ’ 2008-11-03 ’ ) returns ’ Monday ’
Note:
If the given date’s month and year are wrong then null is returned.
If the given date’s value exceeds 31 then null is returned.
The day of a month is returned even if the given date is wrong with respect to the given month. for eg: 31st february 2008 returns 'Sunday’.
If the given date’s value is '0’ then '0’ is returned.
This function works for the years ranging from 0 to 9999.
DAYOFMONTH(date_arg):
Purpose:
Returns the day of the month the date given in the argument is.
Example:
Select DAYOFMONTH ( ’ 2008-11-03 ’ ) returns '3’
Note:
If the given date’s month and year are wrong then null is returned.
If the given date’s day value exceeds 31 then null is returned.
The date of a month is returned even if the given date is wrong with respect to the given month. for eg: 31st february returns 31.
If the given date’s value is '0’ then '0’ is returned.
This function works for the years ranging from 0 to 9999.
DAYOFYEAR(date_arg):
Purpose:
Returns the given date’s count from the start of the year.
Example:
Select DAYOFYEAR ( ’ 2008-12-25 ’ ) returns '360’
Note:
Returns null if the given date and month are '0’ .
The range of the result is between 1 and 366.
DATE_ADD(date_arg, numeric_arg):
Purpose:
Returns the given date after performing the required arithmetic on it. DATE_ADD is currently not supported by Zoho Analytics.
DATE_SUB(date_arg, numeric_arg):
Purpose:
Returns the given date after performing the required arithmetic on it. DATE_SUB is currently not supported by Zoho Analytics.
EXTRACT(command from date.time_arg):
Purpose:
Returns the required part of the date-time value after extraction from the given date-time argument.
Example:
Select EXTRACT ( HOUR_SECOND FROM ’ 2009-07-02 01:02:03 ’ ) returns ’ 10203 ’
FROM_DAYS(numeric_arg):
Purpose:
The count of days is started from the date 01-01-01. The argument value is taken as count and its corresponding date is displayed.
Example:
Select FROM_DAYS ( 733714) returns ’ 2008-11-03 ’
Note:
The count starts from the number 366 which is the count for the date '0001-01-01’
FROM_UNIXTIME(numerical_arg):
Purpose:
For the given argument the value of the internal timestamp is returned.
Example:
Select FROM_UNIXTIME (1225741235) returns ’ 2008-11-03 19:40:35 ’
Note:
Returns the result in number value or string value depending on the type of the given input argument.
HOUR(time_arg):
Purpose:
Returns the number of hours present in the given time value. The time is given in the form 'hr : min : sec’
Example:
Select HOUR (’ 220:22:34 ’) returns '220’
Note:
Returns null if the value of minutes or seconds exceed '59’
If the time is given in decimal form then '0’ is returned.
LAST_DAY(date.time_arg):
Purpose:
Returns the last date of the given date-time argument’s month.
Example:
Select LAST_DAY ( ’ 2004-02-31 01:02:03 ’ ) returns '29’
Note:
Returns null if the given day, month or year is wrong or exceeds their range.
LOCALTIMESTAMP():
Purpose:
The present date-time values of the application’s time zone is returned. The result is returned in the form of ’ yr : mth : dt hr : min : sec ’.
Example:
Select LOCALTIMESTAMP () returns '2008-08-23 12:59:41’
Note:
The result is returned in numeric form or string according to the function’s use in the query.
MAKEDATE(numeric_arg, numeric_arg):
Purpose:
The argument contains the year and the count of the day for that year. The date is returned.
Example:
Select MAKEDATE ( 2008,215 ) returns ’ 2008-08-03 ’
Note:
Returns null if the count passed is '0’.
If the count is greater than 366, then the year of the date also changes.
MICROSECOND(date.time_arg):
Purpose:
From the given date-time argument value, the microsecond term alone is returned.
Example:
Select MICROSECOND ( ’ 2008-11-04 17:16:50.123 ’ ) returns '123000’
Note:
The default number of microsecond digits that is returned is '6’
Returns '0’ if there is no microsecond term in the argument.
MID(date_arg, numeric_arg):
Purpose:
If the given date of a new year is in the middle of the week of the previous year then the count of the last week of the previous year is returned.
Example:
Select MID ( YEARWEEK ( ’ 2001-01-06 ’ ),5 ) returns ’ 53 ’
MINUTE(time_arg):
Purpose:
Returns the number of minutes present in the given time value. The time is given in the form 'hr : min : sec’
Example:
Select MINUTE (’ 220:22:34 ’) returns '22’
Note:
Returns null if the value of minutes or seconds exceed '59’
If the time is given in decimal form then '0’ is returned.
MONTH(date_arg):
Purpose:
This function returns the month of the given date.
Example:
Select MONTH ( ’ 2008-08-03 ’ ) returns '8’
Note:
Returns '0’ if the given date contains '00’ months.
The range of the year should be between 0 to 9999.
NOW():
Purpose:
The present date-time values of the application’s time zone is returned. The result is returned in the form of ’ yr : mth : dt hr : min : sec ’. Its function is same as LOCALTIMESTAMP()
Example:
Select NOW () returns '2008-08-23 12:59:41’
Note:
The result is returned in numeric form or string according to the function’s use in the query.
PERIOD_ADD(numeric_arg, numeric_arg):
Purpose:
The argument contains the date and the number of months to be added to it. The date is passed in the format of period i.e 'yrmth’.
Example:
Select PERIOD_ADD ( 198608,06 ) returns ’ 198702 ’
Note:
The date that is passed or returned is not a date value, but is a period value.
If the date is passed in the usual form i.e in the format of 'yr:mth:dt’ then the result value that is returned is wrong.
PERIOD_DIFF(numeric_arg, numeric_arg):
Purpose:
2 dates in the form of period values are passed in the arguments. The number of months present between the 2 values is returned.
Example:
Select PERIOD_DIFF ( 198608, 198606 ) returns ’-10’
Note:
Both the arguments should be in date-period form.
Returns the result in positive if the second period is chronologically first.
Returns the result in negative if the second period is chronologically second.
QUARTER(date_arg):
Purpose:
For the given date, the corresponding quarter of year is returned, ie returns '1’ if the months are 1,2,3; returns 2 if the months are 4,5,6; returns 3 if the months are 7,8 9 and returns 4 if the months are 10,11,12.
Example:
Select QUARTER ( ’ 2008-08-23 ’ ) returns '3’
Note:
Returns '0’ if the given month is '0’.
Returns null if the given date’s year, month or day is out of range.
Returns the corresponding month’s quarter even if the year or day or both are '0’.
SEC_TO_TIME(numeric_arg):
Purpose:
The argument passed is the count of seconds of a day. It’s value in hours, minutes and seconds are returned.
Example:
Select SEC_TO_TIME ( 86399 ) returns ’ 23:59:59 ’
Note:
At '86400’ the value of 'hr:min:sec’ are resetted to '0’ and the cycle starts again.
As soon as a non-numeric character is found in the string then the SEC_TO_TIME of the numbers before the character is returned.
Depending on the given argument format the result is given in the form of number or string.
SLEEP(numeric_arg):
Purpose:
This function is currently not supported by Zoho Analytics.
STR_TO_DATE(numeric_arg, string_arg):
Purpose:
Returns the date-time value after its conversion from the given string. The conversion is done after taking note of the format of the given string . The format is given as second argument.
Example:
Select STR_TO_DATE ( ’ 06/31/2004 ’, ’ %m/%d/%Y ’ ) returns ’ 2004-07-01 ’
Note:
Returns null if the date, month or year exceeds their respective range.
Returns the date or time value depending on the respective presence in the string.
SUBDATE(date.time_arg, numeric_arg):
Purpose:
Returns the date-time value after subtracting the number of days passed in the second argument from the date-time value passed in the first argument.
Example:
Select SUBDATE ( ’ 2008-02-19 12:00:00 ’, 31 ) returns ’ 2008 -01-19 12:00:00 ’ Select SUBDATE ( ’ 2008-02-19 ’, INTERVAL 31 DAY ) // This query is currently not supported by Zoho Analytics
Note:
The range of years for which the function works correctly is '200-9999’. Returns wrong value if year is below '200’ and returns null if it is above '9999’
Returns null if the month is a number other than 1-12.
Returns null if the day is a number other than 1-31.
SUBTIME(date.time_arg, time_arg):
Purpose:
The first argument is a date-time value and the second argument is a time value. The subtraction value of second argument from the first argument is returned.
Example:
Select SUBTIME ( ’ 1986-08-03 18:45:00 ’ , ’ 03:45:00 ’ ) returns ’ 1986-08-03 15:00:00 ’
Note:
Returns null if the date value is passed in the second argument.
The range of years for which the function works correctly is '200-9999’. Returns wrong value if year is below '200’ and returns null if it is above '9999’.
Returns null if the month is a number other than 1-12.
Returns null if the day is a number other than 1-31.
SYSDATE():
Purpose:
The present date-time value of the application’s time zone is returned in the form of ’ yr : mth : dt hr : min : sec ’.
Example:
Select SYSDATE () returns ’ 2008-11-05 05:41:16 ’
Note:
The result is returned in numeric form or string form according to the function’s use in the query.
TIME(date.time_arg):
Purpose:
From the given date-time value argument, the time value is returned.
Example:
Select TIME ( ’ 2008-11-05 17:34:45 ’ ) returns ’ 17:34:45 ’
Note:
If the date value alone is passed, then the function assumes the year term as the time and returns it.
Returns null if the date value is wrong.
TIMEDIFF(time_arg, time_arg):
Purpose:
Returns the difference between the 2 time values passed in the 2 arguments.
Example:
Select TIMEDIFF('20:08:05’,'20:07:34’) returns '00:00:31’
Note:
The first argument should be greater than the second argument or else the function will not work.
If date value is passed in the any one argument null is returned.
If date value is passed in both the arguments then the function will not work.
TIMESTAMP(date.time_arg, time_arg):
Purpose:
The first argument contains both the date and time values. The second argument should contain only the time values. Both the arguments are added and the resultant date-time value is returned.
Example:
Select TIMESTAMP ( ’ 2008-11-05 19:00:00 ’ , ’ 06:00:00 ’ ) returns ’ 2008-11-06 01:00:00 ’
Note:
Returns the date time values of the first argument alone if only the first argument is passed.
Returns null if the second argument contains date values.
TIMESTAMPADD():
Purpose:
This function is currently not supported by Zoho Analytics.
TIMESTAMPDIFF():
Purpose:
This function is currently not supported by Zoho Analytics.
Purpose:
The first argument is the time and the second argument is the format string containing format specifiers. The formatted value is returned.
Example:
Select TIME_FORMAT ( ’ 19:30:41.32 ’ , ’ %k %l %i %s %f ’ ) returns ’ 19 7 30 41 320000 ’
Note:
The format string must contain only the time format specifiers.
Even if a single non-time specifier is passed then only null value is returned.
TIME_TO_SEC(time_arg):
Purpose:
For the time value passed the total number of seconds is returned after converting the minutes and hours to seconds.
Example:
Select TIME_TO_SEC ( ’ 01:00:00 ’ ) returns ’ 3600 ’
TO_DAYS(date_arg):
Purpose:
Converts the passed date argument to the total number of days passed since the date '0001-01-01’
Example:
Select TO_DAYS ( ’ 2008-11-07 ’ ) returns ’ 733718 ’
Note:
The range of years for which the function works correctly is '200-9999’. Returns wrong value if year is below '200’ and returns null if it is above '9999’.
Returns null if the month is a number other than 1-12.
Returns null if the day is a number other than 1-31.
UNIX_TIMESTAMP(date.time_arg):
Purpose:
Returns the number of seconds completed since the date ’ 1970-01-01 00:00:00 ’
Example:
Select UNIX_TIMESTAMP ( ’ 1970-01-01 00:30:00 ’ ) returns ’ 1800 ’
Note:
Returns '0’ if a date earlier than the date ’ 1970-01-01 00:00:00 ’ is passed.
UTC_DATE():
Purpose:
The present UTC date is returned.
Example:
Select UTC_TIMESTAMP () returns ’ 2008-11-06 05:40:58 ’
Note:
Returns the current datetime value as a number or a string value depending on the format of function used.
UTC_TIMESTAMP():
Purpose:
The present UTC date-time value is returned.
Example:
Select UTC_TIMESTAMP () returns ’ 2008-11-06 05:40:58 ’
Note:
Returns the current datetime value as a number or a string value depending on the format of function used.
WEEK(date_arg):
Purpose:
Returns the week of the year in which the given date is present.
Example:
Select WEEK(’ 2008-01-14 ’) returns '2’
Note:
By default the week is assumed to be starting on Sunday.
If we want the week to start from Monday then we should pass a MODE in the second argument.
WEEKDAY(date_arg):
Purpose:
Returns the day of the week the given date is. Returns '0’ if its a Monday, '1’ if its Tuesday,……'6’ if it is Sunday.
Example:
Select WEEKDAY ( ’ 2008-11-06 ’ ) returns '3’ since its a thursday.
Note:
The given argument can be a date-time value or only a date value.
WEEKOFYEAR(date_arg):
Purpose:
Returns the week of the year in which the given date is present.
Example:
Select WEEKOFYEAR ( ’ 2008-01-14 ’ ) returns '2’
Note:
Unlike WEEK(), in this function the second argument cannot be used.
YEAR(date_arg):
Purpose:
This function returns the year of the given date.
Example:
Select YEAR ( ’ 2008-11-22 ’ ) returns ’ 2008 ’
Note:
The range of the year should be between 0 to 9999.
Returns null if the given date, month or year is wrong.
YEARWEEK(date_arg):
Purpose:
Starting the count of the first week from the date '0000-01-01’ the week of the given date is returned.
Example:
Select YEARWEEK ( ’ 2000-01-02 ’ ) returns ’ 200001 ’
Note:
Returns null if the month is a number other than 1-12.
Returns null if the day is a number other than 1-31.
Returns null if the year is a number above 9999.
MySQL AGGREGATE FUNCTIONS
The MySQL in-built Aggregate functions supported by Zoho Analytics.
AVG(numeric_arg):
Purpose:
Returns the average of the given term’s values.
Example:
Select AVG (col1) from "tab5” returns '3’ // Here 'tab5’ is the table name and 'col1’ is the column name.
Note:
Returns null if the column does not contain any values.
Returns '0.0’ if a non-numeric character occurs in the values.
BIT_AND(numeric_arg):
Purpose:
The Bitwise AND calculation is performed on the given table’s values and the result is returned.
Example:
SELECT BIT_AND (numCol) from “ allTypeTest ” returns '33’ // The Bitwise_AND of the values of 'numcol’ rows from the Workspace 'allTypeTest’ is returned.
Note:
Returns null if the column does not contain any values.
Returns '0’ if a non-numeric character occurs in the values.
BIT_OR(numeric_arg):
Purpose:
The Bitwise OR calculation is performed on the given table’s values and the result is returned.
Example:
SELECT BIT_OR (numCol) from “ allTypeTest ” returns '127’ // The Bitwise_OR of the values of 'numcol’ rows from the Workspace 'allTypeTest’ is returned.
Note:
Returns null if the column does not contain any values.
Returns '0’ if a non-numeric character occurs in the values.
BIT_XOR(numeric_arg):
Purpose:
The Bitwise XOR calculation is performed on the given table’s values and the result is returned.
Example:
SELECT BIT_XOR ( numCol ) from “ allTypeTest ” returns '121’ // The Bitwise_XOR of the values of 'numcol’ rows from the Workspace 'allTypeTest’ is returned. Select ATAN ('0.5A@5’) returns '0.46364760900081’ // As soon as a non numeric character is found in the number string the number’s value is returned.
Note:
Returns null if the column does not contain any values.
Returns '0’ if a non-numeric character occurs in the values.
COUNT(numeric_arg):
Purpose:
Counts the number of rows present in the given table.
Example:
Select COUNT (numCol) from “ allTypeTest ” returns '6’ // since 'numcol’ column from the Workspace 'allTypeTest’ contains 6 rows.
Note:
Returns '0’ if the column does not contain any values.
The values can be both numbers and string.
GROUP_CONCAT(numeric_arg):
Purpose:
Concatenates the string values present in the given table.
Example:
Select GROUP_CONCAT ( plainCol ) from “allTypeTest” returns 'Hello,Hlo,Hello,Hlo,Hello,Hlo’ Select GROUP_CONCAT ( DISTINCT plainCol ) from “allTypeTest” returns 'Hello,Hlo’ // Does not repeat the output string.
Note:
Returns null if the column does not contain any values.
MAX(string_arg, numeric_arg1, numeric_arg2):
Purpose:
The values present in the given columns are compared with each other and the maximum value is returned. The maximum value of both numbers and string are returned.
Example:
Select MAX (col3 ) from “tab2” returns 'sat’
Note:
Returns null if the column does not contain any values.
MIN(numeric_arg):
Purpose:
The values present in the given columns are compared with each other and the minimum value is returned. The minimum value of both numbers and string are returned.
Example:
Select MIN (col3 ) from “tab2” returns 'chk’
Note:
Returns null if the column does not contain any values.
STD(number1, number2):
Purpose:
The standard deviation of the given table’s numeric values are calculated and returned.
Example:
Select STD ( col2 ) from “ tab6 ” returns '8.0554’
Note:
Returns null if the column does not contain any values.
Returns '0.0’ if the column contains only non-numeric character values.
SUM(numeric_arg):
Purpose:
The sum of the given table’s values are calculated and returned.
Example:
Select SUM ( col2 ) from “ tab6 ” returns '32.0’
Note:
Returns null if the column does not contain any values.
Returns '0.0’ if the column contains only non-numeric character values.
VARIANCE(numeric_arg):
Purpose:
The variance of the given table’s values are calculated and returned.The logarithm of the number to the base 10 is returned.
Example:
Select VARIANCE ( col2 ) from “ tab6 ” returns '64.8889’
Note:
Returns null if the argument is null, negative or any non-numeric character.
Returns '0.0’ if the column contains only non-numeric character values.
API Usage Limits & Pricing
Zoho Analytics API usage will be measured based on units consumed & frequency of API calls.
The API Units and frequency calculations are described in this section. API units allowed are scoped by each of the pricing plans .
In order to ensure effective resource utilization and service quality, Zoho Analytics controls API Usage based on units of usage and frequency of invocation of API calls. The details of these are described in the document.
API Units
Each Zoho Analytics API method has been associated with a defined quantum of units. The units consumed by your application will be calculated based on how often the different API methods are invoked in your application on a per day basis.
Each Zoho Analytics pricing plan will be capped with an allowed units per day. The limits will be applied based on your Zoho Analytics plan. You can also purchase add-on units on need.
Pricing Plans and API Units allowed per Day:
Plan
API Units per Day
Free
1,000 units
Basic
4,000 units
Standard
10,000 units
Premium
30,000 units
Enterprise
100,000 units
For example, a user account in Zoho Analytics Standard plan, can only consume a maximum of 10,000 API units per day.
Units Calculation for each API Method/Action
The table below provides how many units will be consumed invoking each of the different types of API methods
For example, making a “IMPORT” API (Import APPEND Type) call to import 10,000 rows the units consumed will be: (10,000/1,000) * 10 units = 100 units consumed.
Note:When the total API Units consumed per day exceeds the allowed units for the purchased plan, Zoho Analytics will send the error response with code 6043 (or) 6044.
API Frequency
API frequency refers to the number of API requests made per minute. Different API types have different frequency limits. Find below, the frequency limit thresholds for each API type. For example, in a minute, a maximum of 100 requests can only be sent for the DML type API.
API Frequency per minute
API TYPE
Frequency Limit (per minute)
DML
100
BULK
40
METADATA
60
OVERALL *
100
Irrespective of the API TYPE (DML / BULK / METADATA), a maximum of 100 requests can only be allowed per minute. Further requests within the minute will not be processed.
Note:When the number of API requests triggered per minute exceeds the above mentioned allowed frequency limits, Zoho Analytics will send the error response with code 6045.
API Units Add-on Pricing
In case, the API usage goes beyond the allowed limit of the purchased Zoho Analytics plan, the Administrator of the account can either upgrade to any of the higher plans or purchase the API Units as add-on.
API Units/Day
Amount (Monthly)
10,000 units/day
$15
25,000 units/day
$25
50,000 units/day
$40
100,000 units/day
$60
200,000 units/day
$80