Quantcast
Channel: Zoho Reports API
Viewing all 71 articles
Browse latest View live

Export-Data-java :: Version3.2

$
0
0

ExportData.java

The following sample code is for exporting data in table/report. In this example we export the "Sales Across Regions" chart as an PNG image. Also the data exported in the chart is filtered based on the following condition i.e. only data matching the following criteria will be displayed in the chart exported.

("Region" = 'Central') and ("Product Category" = 'Stationary')

Before trying it out

public class ExportData
{
    private ReportClient rc = Config.getReportClient();

    public void exportData() throws Exception
    {
        String uri = rc.getURI(Config.LOGINEMAILID,Config.DATABASENAME,"Sales");
        File xmlFile = new File("Test.xml");
        rc.exportData(uri,"XML",xmlFile,null,null);
        System.out.println("Data successfully exported in xml format to" + xmlFile.getAbsolutePath());
        
        //Exports data with criteria.
        File csvFile = new File("Test.csv");
        rc.exportData(uri,"CSV",csvFile,getCriteria(),null);
        System.out.println("Data(filtered by criteria " + getCriteria() + ")\n successfully exported in csv format to " + csvFile.getAbsolutePath());
        String imgURI = rc.getURI(Config.LOGINNAME,Config.DATABASENAME,"Cost vs Sales");
        File imgFile = new File("SalesInfo.png");
        rc.exportData(imgURI,"IMAGE",imgFile,null,null);
        System.out.println("The image successfully exported as png to   " + imgFile.getAbsolutePath());
    }

    private static String getCriteria()
    {
        return "(\"Region\" = 'Central') and (\"Product Category\" = 'Stationary')";
    }

    public static void main(String[] args) throws Exception
    {
        ExportData exp = new ExportData();

        //call EXPORT API with the same logged in session
        exp.exportData();

    }
}

ExportDataUsingSQL-java :: Version3.3

$
0
0

ExportDataUsingSQL.java

The following sample code exports/fetches data from Zoho Reports using a SQL SELECT query. This is done using Zoho Reports CloudSQL, which enables you to use SQL select query to fetch data from any of your Zoho Reports database.
 
In this example we are fetching the rows from the "Sales" table matching the " Region" as 'East" using a SELECT query.
Before trying it out
import java.io.*;
import com.adventnet.zoho.client.report.*;

public class ExportDataUsingSQL
{
    private ReportClient rc = Config.getReportClient();

    public void exportData() throws Exception
    {
        String uri = rc.getURI(Config.LOGINEMAILID,Config.DATABASENAME);
        String sql = "select "Customer Name",Sales,Cost,Profit from Sales where Region = 'East'";
        File expFile = new File("ExportedDataUsingSQL.csv");
        System.out.println("Exporting data using sql." + sql);
        rc.exportDataUsingSQL(uri,"CSV",expFile,sql,null);
        System.out.println("Data successfully exported to  " + expFile.getAbsolutePath());
    }


    public static void main(String[] args) throws Exception
    {
        ExportDataUsingSQL exp = new ExportDataUsingSQL();

        //call EXPORT API with the same logged in session
        exp.exportData();

    }
}

MetaData-java :: Version3.3

$
0
0

Zoho Reports Metadata

Currently you can obtain the Zoho Report's metadata using the JDBC Driver. Follow the below links to get started.

Sample:

The following code snippet shows the list of databases created by the demouser in Zoho Reports.

import java.util.*;
import java.sql.*;
import java.net.URLEncoder;
import java.io.*;
public class Zoho_GetCatalogs
{
private static final String APIKEY= "bfc2f00820f07f1be4fe97594c590b42";//<your key>
private static final String
USEREMAILID= "abc@zoho.com";//<your login email address>
private static final String PASSWORD = "demouser";//<your password
private static final String DB_NAME= "DEMODB";//<your db name>
private static final String TABLE_NAME="demotable";//<your table name>
public static void main(String args[]) throws Exception
{
Connection conn = null;
Statement stmt = null;
ResultSet catalogs = null;
try
{
Class.forName("com.zoho.cloudsql.jdbc.ZohoReportsDriver");
Properties conProps = new Properties();
conProps.put("ZOHO_API_KEY",APIKEY);
conProps.put("user",USEREMAILID);
conProps.put("password",PASSWORD);
conn = DriverManager.getConnection("https://reports.zoho.com/api"
+ "/" + URLEncoder.encode(USER,"UTF-8")
+ "/" + URLEncoder.encode(DB_NAME,"UTF-8"),
conProps);
DatabaseMetaData dmd = conn.getMetaData();
catalogs = dmd.getCatalogs();
if(catalogs != null)
{
while(catalogs.next())
{
System.out.println(catalogs.getObject("TABLE_CAT"));
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
finally
{
if (catalogs != null){try { catalogs.close(); } catch (Exception e){ e.printStackTrace();}}
if (stmt != null){try { stmt.close(); } catch (Exception e){ e.printStackTrace();}}
if (conn != null){try { conn.close(); } catch (Exception e){ e.printStackTrace();}}
}
}
}

Loading into third party tools:

This document describes the way to get connected with your Zoho Reports database via thrid party tools that support JDBC drivers. To know more about JDBC drivers, kindly visit this page:http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/index.html

The following would be required to setup the connection (write to us at support@zohoreports.com, if you need any assistance)

  • Load the drivers: Generally the connection wizard will have an option to load the drivers. For Zoho Reports, you have to select the files (ZohoReportsAPIClient.jar, ZohoReports_CloudSql_1_0.jar, csv.jar, commons-codec-1.3.jar, commons-httpclient-3.0.1.jar, commons-logging-api.jar)
  • JDBC Driver: Specify com.zoho.cloudsql.jdbc.ZohoReportsDriver
  • Database URL: https://reports.zoho.com/api/<username>/<db_to_connect> (ex: https://reports.zoho.com/api/demouser/SalesDB)
  • UserID: your Zoho Reports' username
  • Password: your Zoho Reports' password
  • ZOHO_API_KEY: <YOUR_ZOHO_API_KEY>.
  • You may have to specify the proxy information (PROXYSERVER, PROXYPORT, PORTUSERNAME, PROXYPASSWORD) if you are connecting through proxy server.

Zoho-Reports-API :: Version12.4

$
0
0

Zoho Reports API

Zoho Reports offers a powerful REST style API (Application Programming Interface) that can be used by Independent Software Vendors, Developers and System Integrators to build powerful reporting and analytical capabilities into their applications. Its a HTTP based Web API, that responds to requests in XML or JSON format making it programming-language-neutral, thus enabling application development/integration in any programming language (Java, Phython, .Net, C, C++, PHP, etc) you know.

With Zoho Reports API developers can easily push or pull data into or from Zoho Reports (data integration) for powerful reporting and analysis. You can add powerful business intelligence capabilities to your product/application, build add-ons to analyze data from third-party business applications (eg., Google Adwords, Google Analytics, CRM systems etc., ) that you use and do much more. Infact Zoho Reports API is used by many Zoho Applications (Zoho CRMZoho Creator, Zoho Sheet...) for seamlessly providing Reporting and Analytical features based on Zoho Reports to their users.

Zoho Reports API allows you to:

  • Add data into a table in Zoho Reports database
  • Modify data in the Zoho Reports database
  • Bulk Add/Update data into a table via CSV file.
  • Bulk Update with criteria support.
  • Bulk Delete with criteria support.
  • Export data and Reports in various formats such as CSV, JSON, PDF,HTML,IMAGE
  • Fetch data from the database using SQL Select query.

This API documentation is organized with the following sections:

Prerequisites

This section lists the prerequisites that need to be satisfied before you use API.

API Specification

Provides the complete API language specification including the request and the response formats of various supported operations

Supported Actions/Operations

Provides the complete list of actions that are supported by Zoho Reports API

Client Libraries

Client libraries are programming language wrappers over the raw Zoho Reports HTTP Web APIs. This enables developers to easily use Zoho Reports API in the corresponding programming language. Currently we support the following language libraries:

 Zoho CloudSQL Support

Zoho CloudSQL is a middleware technology that allows customers to interact with their business data stored in Zoho through familiar SQL language.  Users can access the data in the Zoho cloud using SQL on both other cloud applications as well as through traditional on-premises software.

Zoho Reports is the first service to support CloudSQL as an API extension. Refer to the following links for more details:

Pricing

Pricing model for using Zoho Reports API will be announced in the near future. For any clarification or information in this regard, please mail us to support@zohoreports.com

Expense-and-Income-Tabs :: Version4

$
0
0

Expense and Income Details tab Implementation

Expense Details tab:

The data provided in this report is fetched from the ExpenseDetails table by our Python code using Zoho Reports CloudSQL API. 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 Zoho.

The piece of Python code that executes the SELECT query to fetch the necessary data using Zoho Reports CloudSQL API is given below. This uses the Google App Client Python library of Zoho Reports API:

         # construction of Zoho Reports connection URL
rc = HandleOption.getReportClient(self.reportClient)
uri = rc.getDBURI(Config.LOGINNAME,Config.DATABASENAME)

# construction of the SELECT query
sql = "SELECT \"Date\", Sub_Category, Amount, Description from \
ExpenseDetails order by \"Date\" desc limit 100"
buffer = StringIO.StringIO()

# Execute the above SELECT query and the result set is stored into variable 'buffer'
rc.exportDataUsingSQL(uri,"CSV",buffer,sql,None)

# result set in variable 'buffer' is read using the csv reader utility function.
csvData = buffer.getvalue()
reader = csv.reader(StringIO.StringIO(csvData))

The result set of the above query (returned in a CSV format) is processed by a CSV reader. The following code processes this data from the CSV reader into a Array and generates the HTML table required:

                for row in reader:
expenseRow = []
j = 0
while(j < 4):
expenseRow.append(row[j])
j += 1
expenseDetails.append(expenseRow)
i +=1

values = {'expenseDetails': expenseDetails}

The HTML snippet that embed the result set:

		{% for expenseRow in expenseDetails %}
  <tr>
<td align="left">{{expenseRow.0}}</td>
 <td align="left">{{expenseRow.1}}</td>
 
<td align="right" style="padding-right:10px;">{{expenseRow.2}}</td>
 <td align="left" style="padding-left:10px;">{{expenseRow.3}}</td>
 </tr>
{% endfor %}

Click here to download the full code.

For more details on Zoho Reports CloudSQL, click here.


Income Details tab:

A Datasheet view of the IncomeDetails table in Zoho Reports database is embedded under this tab. This report demonstrates embedding the Table with Search box from Zoho Reports.

Click here to access Zoho Reports - Personal Finance Database used to generate the above reports.

Next: Reference Links

SSO-Integration :: Version1.6

$
0
0
SSO API is only available for White Label customers of Zoho Reports. If you want to know about SSO Integration, email support@zohoreports.com

Single Sign On Integration



  • Setup Phase
  • APIS
    • Sign Up API
    • Sign In API
    • Sign Out API
  • Workflow Test Scenarios
  • Integration Test Scenarios
  • Other Terms & Conditions



Zoho Reports offer a full-fledged white label (private label) solution. As a part of it, 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 Reports 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

  1. Provide the following information to the Zoho Reports 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 Reports; needed for your test and production setups too)
    • Domain/sub-domain names (CNAME mapping) for test and production setups. CNAME map your test/production sub-domains to customer-reports.zoho.com
    • Fill the following Zoho Creator form to design your custom page - https://creator.zoho.com/zohodbhelp/domain-rebranding/#Form:DomainProperties
  2. After submitting the above information to the Zoho Reports 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/)

APIs

  • Sign Up
  • Sign In
  • Sign Out

Sign Up API

URL Format

<form method="POST" action="https://accounts.zoho.com/internal/sso.zp" 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="login_name" value="[name of the user as displayed]">

<input type="hidden" name="full_name" value="[
Same as login name]"> <input type="submit" value="Sign Up" class="divbutton" name="submit">
</form>


Important: You need to send an HTTPS POST request to Zoho Reports for user Sign Up API.

Input Parameters for Sign Up API
Parameter
Description
operation
Value is "signup"
email
Email Id of the user to sign up
login_name
Name of the user as displayed.

User name should contain only alphanumeric characters, (_) underscore and (.) dot. Space and other special characters are not allowed.

full_name
Same as login name
apikey
Your API key


Note:

  • full_name and login_name should be the same
  • full_name and login_name should be a valid Zoho user name (6-30 characters long containing only numbers, alphabets, underscores and dot)

 
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 Reports. 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.


Sample Success Response
{
"ticket":"666b88566441b69d1a137db824314b6a9be8959a75b1a1be8b951c6e18f352bb2e068f7f697fa4879e365e19967a5b537a08c8e85058625130e54e8467d85259",
"result":"success",
"zuid":5471
}

Sample Failure Response

{
"result":"failure",
"cause":"Invalid APIKey"
}

Sign In API

URL Format
<form method="POST" action="https://accounts.zoho.com/internal/sso.zp" 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" value="Sign In" class="divbutton" name="submit">
</form>

Important: You need to send an HTTPS POST to Zoho Reports for user Sign In API.

Input Parameter for Sign In API
Parameter
Description
operation
Value is "signin"
apikey
Your API key
email
Email address of the user to sign in

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 Reports. This needs to be passed to Zoho as part of the URL.
cause
This attribute present in the response, only in case of failure


Sample Success Response
{
"ticket":"666b88566441b69d1a137db824314b6a9be8959a75b1a1be8b951c6e18f352bb2e068f7f697fa4879e365e19967a5b537a08c8e85058625130e54e8467d85259",
"result":"success",
"zuid":5471
}

Sample Failure Response

{
"result":"failure",
"cause":"Invalid APIKey"
}

Sign Out API

URL Format:

https://reports.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) completed in your server/application. Above URL will sign out from Zoho Reports and will redirect to your login page.

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 Reports environment (customer-reports.zoho.com). For this particular documentation, we will assume that this domain mapping is https://reports.finepick.com./ Replace this with your own mapping URL.
  • Zoho Reports environment is located at customer-reports.zoho.com 

Test Login Flow
  1. Invoke the Sign Up or Sign In API above and get a ticket.
  2. Invoke the white label URL with the ticket as the only argument. Example: https://reports.finepick.com?ticket=[obtained ticket]
  3. The user identified by the ticket can operate till the ticket is logged off or all cookies are cleared (in which case step 2 should be followed again).

Test Logout Flow
  1. After logging in using the steps above, invoke the Sign out API from your server/application to Zoho Reports server.
  2. Try using the same ticket 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.
  1. Test the login flow as the first User
  2. Then use the ticket for User 2 and visit the site (using the same steps outlined in Test Login flow). - Domain will ignore the second ticket when one session is already active - so you will still see the session as user 1.
 

Integration Test Scenarios

Website driven Login flow
  1. User logs in to the main website.
  2. User clicks on a link that leads to the white-label site.
  3. White-label site requires login credentials of the user - which are not found in the current session
  4. So Zoho Reports 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://reports.finepick.com)
  5. 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.
  6. With the newly generated ticket, finepick.com routes the user's browser to the service URL (in this example, https://reports.finepick.com)/ along with the single parameter called "ticket" (the routed url is https://reports.finepick.com?ticket=[generated ticket])
  7. Now white label site recognizes the user.

White label driven Login flow
  1. User visits the white label domain directly.
  2. If no login credentials for the user is found, then Zoho Reports 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://reports.finepick.com)
  3. The login page of finepick.com, collects and processes the user's login credentials based on the data stored in finepick.com
  4. 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 zoho ticket
  5. After successfully obtaining the zoho ticket, the user's browser should be forwarded to the url denoted by service url (in this example, https://reports.finepick.com)/ along with the single parameter called "ticket" (the routed url is https://reports.finepick.com?ticket=[generated ticket])
  6. Now the white label site (Zoho Reports) recognizes the user.

 Website Logout Flow:
  1. When the user clicks on the logout URL in the website, the website should call the Zoho Reports signout API and invalidate the ticket.
  2. The signout API call is a must!

White -label Logout Flow:
  1. 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
  2. Zoho will automatically clear all cookies and session information about the user from Zoho's end.

Other Terms & Conditions:
  1. 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.
  2. A full demo of the integration needs to be provided to the Zoho team.

Share :: Version6.2

$
0
0
Note: Share API is currently available only on request for users. If you want to know more about Share API, email support@zohoreports.com

Sharing



1. It is mandatory to use HTTPS in all API requests instead of HTTP request. HTTP is not supported

2. Always use https://reportsapi.zoho.com as the API request URL.

With the Zoho Reports Share API, you can share the views (tables/reports/dashboards) created in Zoho Reports with users. The Share API also allows you to the revoke sharing permission granted. It is recommended that you go through the documentation on How sharing works in Zoho Reports, before using the API for better understanding.

Note: Sharing permissions can be updated by calling 'Share' again (over riding the existing share permissions).

Share - Sample URL

https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB?ZOHO_ACTION=SHARE
&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML
&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0


Deprecation Note

1. It is no longer mandatory to pass the ZOHO_API_KEY parameter as part of the query string in the URL. This will be deprecated soon. In case you are using it, you can remove it.

2. Usage of Ticket in API requests is deprecated. Users are strongly recommended to use Auth Token instead of Ticket in your API requests, as support for Ticket will be removed in the near future.

3. Recommended to use Zoho Reports Login Email Address in the API URL instead of Zoho Username.

Data sent as POST parameters (URL Encoded)


Parameter
Possible Values
Description
Remarks

ZOHO_VIEWS

Table1,View1,View2,My%20View

List of views which are to be shared. Multiple views can be shared by providing them separated by comma

Note: ZOHO_VIEWS is encoded in URL encoding format. Value without encoding is given below:

ZOHO_VIEWS=Table1,View1,View2,My View

Mandatory parameter

ZOHO_EMAILS

user1%40finepick.com, user2%40finepick.com

User email addresses as comma separated values to whom the views need to be shared.

Note:
ZOHO_EMAILS is encoded in URL encoding format. Value without encoding is given below:


 ZOHO_EMAILS=user1@finepick.com,user2@finepick.com

Mandatory parameter


POST parameters for fine-grained permissions (At least one parameter is required from the below)

Parameter
Allowed Values
Default value
Description
Remarks
ZOHO_READ
true or false
false
Read Access to the view

ZOHO_EXPORT
true or false
false
Export permission for a view

ZOHO_VUD
true or false
false
Permission to view underlying data in a Chart / Pivot / Summary view

ZOHO_ADDROW
true or false
false
Permission to add a row in the table

ZOHO_UPDATEROW
true or false false
Permission to update a row in the table
ZOHO_DELETEROW
true or false false
Permission to delete a row in the table

ZOHO_DELETEALLROWS true or false false
Permission to delete all rows in the table

ZOHO_IMPORT_APPEND
true or false false
Permission to import data into the table using APPEND option

ZOHO_IMPORT_ADDORUPDATE
true or false false
Permission to import data into the table using ADD or UPDATE option i.e new rows will be appended and existing rows will be updated based on the matching columns provided in IMPORT action

ZOHO_IMPORT_DELETEALLADD
true or false false
Permission to import data into the table using the option: deleting all the existing records and adding the new records

ZOHO_SHARE
true or false false
Permission to share the table / view to others


 

Other Parameters

Parameter
Allowed Values
Default Value
Description
Remarks
ZOHO_CRITERIA
Filter Criteria should be specified in the format as given in the example below. It is similar to a WHERE clause in SQL languages. Read More

ZOHO_CRITERIA:

This parameter allows you to apply a filter criteria while sharing a view to users. The specified criteria will be applied on the reports shared, there by filtering the data viewed, when the report is accessed by the shared user.

Refer the below link to use ZOHO_CRITERIA:

https://zohoreportsapi.wiki.zoho.com/Applying-Filters.html

ZOHO_INHERIT_PARENT_CRITERIA
true or false
false
This is valid only for reports(not tables). If true, then its parent tables' criteria is also taken into account while sharing

ZOHO_INVITE_MAIL
true or false
false
Whether to send an invitation mail on sharing
For White Label Customers:

If this parameter is set to 'true', use your white label domain URL instead of reportsapi.zoho.com in the Share API request.

ZOHO_MAIL_SUBJECT


Required only if ZOHO_INVITE_MAIL is true

ZOHO_MAIL_MESSAGE




ZOHO_INVITE_MAIL_CCME
true or false
false
Whether to CC the invitation mail to you on sharing
This parameter is valid only if ZOHO_INVITE_MAIL is true

Share - Sample Success Response

XML

<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/api/abc@zoho.com/EmployeeDB" action="SHARE">
<result>success</result>
</response>


JSON

{ "response"; {

"uri": "/api/abc@zoho.com/EmployeeDB", "action": "SHARE", "result": "success" } }

Remove Share

Sample URL

URL

https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB?ZOHO_ACTION=REMOVESHARE
&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML
&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0

Note: Usage of Ticket in API requests is deprecated. Users are strongly recommended to use Auth Token instead of Ticket in your API requests, as support for Ticket will be removed in the near future. 

 

Data Sent as POST parameters (URL Encoded):

Parameter Allowed Values Default Value Description Remarks
ZOHO_VIEWS Table1,View1,View2,My%20View
Views whose sharing need to be removed. Multiple views can be passed using comma separator.

Note:
ZOHO_VIEWS is encoded in URL encoding format. Value without encoding is given below:

ZOHO_VIEWS=Table1,View1,View2,My View




Any one of these two parameter is a mandatory Parameter

ZOHO_ALLVIEWS
true or false
false
If true passed to this parameter it will remove the sharing for all the views which are shared to the corresponding users (users identified by the email addresses passed in the parameter ZOHO_EMAILS)
ZOHO_EMAILS user1%40finepick.com, user2%40finepick.com
User email addresses as comma separated values to whom the sharing need to be removed for the specified views

Note:
ZOHO_EMAILS is encoded in URL encoding format. Value without encoding is given below:


 ZOHO_EMAILS=user1@finepick.com,user2@finepick.com
Mandatory Parameter

Remove Share - Sample Success Response

XML

<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/api/abc@zoho.com/EmployeeDB" action="REMOVESHARE">
<result>success</result>
</response>


JSON

{ "response"; {

"uri": "/api/abc@zoho.com/EmployeeDB", "action": "REMOVESHARE", "result": "success" } }

With the Zoho Reports Database Owner API, you can add / remove the multiple database owners for a database. It is recommended that you go through the documentation on How multiple database owners works in Zoho Reports, before using the API for better understanding.

Add Database Owner - Sample URL

https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB?ZOHO_ACTION=ADDDBOWNER
&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML
&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0

Note: Usage of Ticket in API requests is deprecated. Users are strongly recommended to use Auth Token instead of Ticket in your API requests, as support for Ticket will be removed in the near future. 

 

Data sent as POST parameters (URL Encoded)

Parameter
Possible Values
Description
Remarks

ZOHO_EMAILS

user1%40finepick.com, user2%40finepick.com

User email addresses as comma separated values to whom database ownership need to be provided

Note:
ZOHO_EMAILS is encoded in URL encoding format. Value without encoding is given below:


 ZOHO_EMAILS=user1@finepick.com,user2@finepick.com

Mandatory parameter

Other Parameters:

Parameter
Allowed Values
Default Value
Description
Remarks
ZOHO_INVITE_MAIL
true or false
false
Whether to send an invitation mail on sharing
For White Label Customers:

If this parameter is set to 'true', use your white label domain URL instead of reportsapi.zoho.com in the Share API request.

ZOHO_MAIL_SUBJECT


Required only if ZOHO_INVITE_MAIL is true

ZOHO_MAIL_MESSAGE




Add Database Owner - Sample Success Response

XML

<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/api/abc@zoho.com/EmployeeDB" action="ADDDBOWNER">
<result>success</result>
</response>


JSON

{ "response"; {

"uri": "/api/abc@zoho.com/EmployeeDB", "action": "ADDDBOWNER", "result": "success" } }


Remove Database Owner - Sample URL

https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB?ZOHO_ACTION=REMOVEDBOWNER
&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMA
T=XML
&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0


Note: Usage of Ticket in API requests is deprecated. Users are strongly recommended to use Auth Token instead of Ticket in your API requests, as support for Ticket will be removed in the near future. 

Data sent as POST parameters (URL Encoded)

Parameter
Possible Values
Description
Remarks

ZOHO_EMAILS

user1%40finepick.com, user2%40finepick.com

User email addresses as comma separated values to whom database ownership need to be removed

Note:
ZOHO_EMAILS is encoded in URL encoding format. Value without encoding is given below:


 ZOHO_EMAILS=user1@finepick.com,user2@finepick.com

Mandatory parameter

Other Parameters:

Parameter
Allowed Values
Default Value
Description
Remarks
ZOHO_INVITE_MAIL
true or false
false
Whether to send a mail on sharing removal
For White Label Customers:

If this parameter is set to 'true', use your white label domain URL instead of reportsapi.zoho.com in the Share API request.

ZOHO_MAIL_SUBJECT


Required only if ZOHO_INVITE_MAIL is true

ZOHO_MAIL_MESSAGE




Remove Database Owner - Sample Success Response

XML

<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/api/abc@zoho.com/EmployeeDB" action="REMOVEDBOWNER">
<result>success</result>
</response>


JSON

{ "response"; {

"uri": "/api/abc@zoho.com/EmployeeDB", "action": "REMOVEDBOWNER", "result": "success" } }

Importing-Bulk-Data :: Version7.7

$
0
0

Importing Bulk Data




1. It is mandatory to use HTTPS in all API requests instead of HTTP request. HTTP is not supported

2. Always use https://reportsapi.zoho.com as the API request URL.


With the Zoho Reports API, you can add/update data in bulk. The data to be added/updated should be in CSV or JSON file formats.

Note:

  • The data should be sent via a https POST request
  • The parameters and the file should be encoded in multi-part/form-data format.(The format used by html forms that contain file type fields used for uploading files)

Importing Data

To import data you need to send an HTTPS POST request using the following URL format.

https://reportsapi.zoho.com/api/<zoho-login_email_address>/<database_name>/<table_name>?ZOHO_ACTION=IMPORT&authtoken=<your_auth_token>&ZOHO_OUTPUT_FORMAT=<XML/JSON>&ZOHO_ERROR_FORMAT=<XML/JSON>&ZOHO_API_VERSION=1.0

Data Sent as POST parameters.

The additional control parameters and the file should be encoded in multi-part/form-data format (The format used by html forms that contain file type fields used for uploading files).
Samples
The following code snippet illustrates importing data from a CSV file into Zoho Reports with POST parameters along with additional control parameters submitted from the HTML form. <html>
<html>
<body>
<form name="ZohoDBImportForm" ENCTYPE="multipart/form-data"method="post"action="https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB/EmployeeDetails?
ZOHO_ACTION=IMPORT&>ZOHO_API_VERSION=1.0&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_OUTPUT_FORMAT=XML">
<input type="file" name="ZOHO_FILE" value="Browse"><br>
ZOHO IMPORT TYPE : <input type="text"name="ZOHO_IMPORT_TYPE" value="APPEND"><br>
ZOHO AUTO IDENTIFY : <input type="text" name="ZOHO_AUTO_IDENTIFY" value="true"><br>
ZOHO CREATE_TABLE : <input type="text" name="ZOHO_CREATE_TABLE" value="false" ><br>
ON IMPORT ERROR : <input type="text" name="ZOHO_ON_IMPORT_ERROR" value="ABORT"><br>
<input type="submit" name="submit" value="Upload">
</body>
</html>
Note: The CSV should contain the column names in the first row.

The following code snippet illustrates importing data from a JSON file into Zoho Reports with POST parameters along with additional control parameters submitted from the HTML form.
<html>
<body>
<form name="ZohoDBImportForm" ENCTYPE="multipart/form-data"method="post"action="https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB/EmployeeDetails?
ZOHO_ACTION=IMPORT&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_OUTPUT_FORMAT=JSON&ZOHO_API_VERSION=1.0">
<input type="file" name="ZOHO_FILE" value="Browse"><br>
ZOHO IMPORT TYPE : <input type="text"name="ZOHO_IMPORT_TYPE" value="APPEND"><br>
ZOHO AUTO IDENTIFY : <input type="text" name="ZOHO_AUTO_IDENTIFY" value="true"><br>
ZOHO CREATE TABLE : <input type="text" name="ZOHO_CREATE_TABLE" value="false" ><br>
ON IMPORT ERROR : <input type="text" name="ZOHO_ON_IMPORT_ERROR" value="ABORT"><br>
<input type="submit" name="submit" value="Upload">
</body>
</html>

Note:

  • You import any type of JSON array with single or multiple objects.
  • In case you import file with multiple JSON objects separated by comma (not enclosed with square brackets), then the first object alone will be imported.
  • JSON object containing simple values without keys are not supported.
  • For more details on the supported JSON formats, refer here.



Deprecation Note

1. It is no longer mandatory to pass the ZOHO_API_KEY parameter as part of the query string in the URL. This will be deprecated soon. In case you are using it, you can remove it.

2. Usage of Ticket in API requests is deprecated. Users are strongly recommended to use Auth Token instead of Ticket in your API requests, as support for Ticket will be removed in the near future.

3. Recommended to use Zoho Reports Login Email Address in the API URL instead of Zoho Username.

Specifying the action

In the query string of the url , the ZOHO_ACTION parameter should be "IMPORT". For other mandatory query string parameters such as ZOHO_OUTPUT_FORMAT, refer this link.

Note: Value of ZOHO_ACTION parameter should be in the same case(UPPER CASE) as given in this document.

Parameters for specifying the Import Options

These parameters are used to specify the various options when importing. Some of these parameters are mandatory and are highlighted and marked with star " * " .

Parameter
Possible Values
Description

ZOHO_FILE*

The file to import


ZOHO_IMPORT_FILETYPE

    CSV/JSON
Optional. Default value is CSV.
Format of the file to be imported. Supported formats are:
  • CSV
  • JSON

ZOHO_CREATE_TABLE

true/false.

Optional. Default is false.

In case it is true, then the table is created if the table referred in the URL doesn't exist in the specified database.

In case its false, no table is created even if the table refered in the URL does not exist in the database.

ZOHO_SELECTED_COLUMNS

List of comma separated column names.

E.g.,: Name, Department
Optional.

Specify the columns to be imported into the Zoho Reports table from the data being uploaded.
Note: Incase of JSON files you need to specify the column names capturing the full JSON tree heirrachy eg., employee.Name, employee.Department

ZOHO_IMPORT_TYPE*

  • APPEND
  • TRUNCATEADD
  • UPDATEADD

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

ZOHO_MATCHING_COLUMNS**

List of comma separated column names.

E.g.,: Name,Department

 

  • Should be passed only when the ZOHO_IMPORT_TYPE is UPDATEADD.
  • The values in the columns to be matched will be used for comparision 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.

ZOHO_IMPORT_JSON_RETCOLNAMES

true/false.

Optional. Default value is false.

This parameter is applicable only for importing JSON files. This defines how the columns names are to be constructed from the JSON file.

  • If set to true, then the final key attribute alone will be considered as column name.
  • If set to false, then 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 heirrachy eg., employee.Name, employee.Department

ZOHO_DATE_FORMAT

Format of the date.

E.g., dd-MMM-YYYY

Optional

The format of date value. Specify this incase any date field is being imported and its format cannot be auto recognized by Zoho Reports.

ZOHO_AUTO_IDENTIFY*

true/false

Used to specify whether to auto identify the CSV format.

ZOHO_SKIPTOP

<number>

Optional

Number of rows that are to be skipped from the top in the CSV file being imported.

ZOHO_THOUSAND_SEPARATOR 0/1/2/3 Optional. Default is 0.
This parameter 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
ZOHO_DECIMAL_SEPARATOR 0/1 Optional. Default is 0.
This parameter controls the action to be taken in case there is a decimal separator in the data.
0 - DOT
1 - COMMA

ZOHO_ON_IMPORT_ERROR*

  • ABORT
  • SKIPROW
  • SETCOLUMNEMPTY

This parameter 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 errored column for the row to empty and continue importing.




CSV Format Details

These parameters need to be specified if the ZOHO_AUTO_IDENTIFY is set to false.

Parameter
Possible Values
Description

ZOHO_COMMENTCHAR

<character>

Comment Character. If the character mentioned is found at the beginning of the row, the csv row will be skipped.

ZOHO_DELIMITER

0 / 1 / 2 / 3

Delimiter which separates the values in the file.

0 - if the delimiter is COMMA

1 - if the delimiter is TAB

2 - if the delimiter is SEMICOLON

3 - if the delimiter is SPACE

ZOHO_QUOTED

0 / 1 / 2

The Text Qualifier.

0 - None

1 - SINGLE QUOTE

2 - DOUBLE QUOTE

JSON Format Details

The following parameters need to be specified while importing data from JSON file.

Sample Success Response

JSON

The following is a sample response in JSON format in case of successful import.

{
" response":
{"uri": "/api/abc@zoho.com/EmployeeDB/EmployeeDetails",
"action": "IMPORT",
"result":
{
"importSummary":
{
"totalColumnCount":3,
"selectedColumnCount":3,
"totalRowCount":50,
"successRowCount":48,
"warnings":0,
"importOperation": "created",
"importType": "APPEND"
},
"columnDetails":
{
"Name": "Plain Text",
"Date Of Birth": "Date",
"Salary": "Number"
},
"importErrors": "[Line: 5 Field: 3] a1213 -WARNING: Invalid Number value"
}
}
}

XML

The following is a sample response in XML format in case of successful import.

<?xml version="1.0" encoding="UTF-8" ?>

<response uri="/api/abc@zoho.com/EmployeeDB/EmployeeDetails" action="IMPORT">
<result>
<importSummary>
<totalColumnCount>3 </totalColumnCount>
<selectedColumnCount>3</selectedColumnCount>
<totalRowCount>50</totalRowCount>
<successRowCount>48</successRowCount>
<warnings>0</warnings>
<importOperation>created</importOperation><importType>APPEND</importType>
</importSummary>

<columnDetails>
<column datatype="Plain Text">Name </column>
<column datatype="Date">Date Of Birth</column>
<column datatype="Number">Salary</column>
</columnDetails>


<!-- The first 100 errors are alone sent -->
<importErrors>
[Line: 5 Field: 3] a1213 -WARNING: Invalid Number value
</importErrors>


</result>
</response>

JDBC-Driver :: Version9.7

$
0
0

Zoho Reports JDBC Driver

JDBC Driver for Zoho Reports CloudSQL

As CloudSQL enables users to execute SQL queries on structured data stored in Zoho Reports, it 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 Reports CloudSQL JDBC driver to connect and execute the necessary SQL queries.

With the availablity of this JDBC driver, developers need not learn the Zoho Reports CloudSQL HTTP Web API to execute the SQL query. They just have know how to use the Zoho Reports JDBC driver and start interacting with the service, the same way as they would interact with a database using a JDBC standard driver.

Zoho Reports JDBC Driver Details:

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 Reports JDBC Driver javadocs to know more about the same. Click to download Zoho Reports JDBC Driver.

JDBC Connection URL for Zoho Reports:

https://reportsapi.zoho.com/api/<zoho_username_dbowner>/<databasename>?user=<zoho_username>&password=<zoho_password>

Sample:

The following Java code snippet shows how you can register Zoho Reports 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();



conProps.put("ZOHO_API_KEY","abcd");


// Zoho username to login to Zoho service
conProps.put("user","david");


// Zoho password to login to Zoho service
conProps.put("password","davidpwd");


// 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 Reports */

// david is the owner of the database 'Sales'
con = DriverManager.getConnection("https://reportsapi.zoho.com/" +
"api/david/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 Reports 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
}
}
}
}


Following methods can also be used to obtain the connection:

DriverManager.getConnection("https://reportsapi.zoho.com/api/david/Sales?" +
"david","davidpwd");

DriverManager.getConnection("https://reportsapi.zoho.com/api/david/Sales?" +
"user=david&password=davidpwd");

Jars to be kept in CLASSPATH for JDBC Driver:

All the jars from 'lib' directory within the JDBC Driver Zip need to be kept in CLASSPATH for JDBC driver.

JDBC Type Mapping with Zoho Reports Data types:

The following table provides the mapping between the Zoho Reports data types and the JDBC SQL types. Use this mapping to process the data fetched from Zoho Reports in your Java code.

Zoho Reports Data type
JDBC SQL Type
Plain Text VARCHAR
Multi Line Text
LONGVARCHAR
Email VARCHAR
Auto Number BIGINT
Number BIGINT
Positive Number BIGINT
Decimal Number DOUBLE
Currency DOUBLE
Percent DOUBLE
Date TIMESTAMP
Decision Box BIT


Javadocs:

Zoho Reports JDBC driver download:

You could download the Zoho Reports JDBC Driver from the below link.

Download - Zoho Reports JDBC Driver


Next: Zoho Reports CloudSQL Client Libraries

Java-Client-Library :: Version5.6

$
0
0

Java Library

The Java client libraries wraps the raw HTTP based API of Zoho Reports with easy to use methods for Java language. This enables Java developers to easily use Zoho Reports API.

Javadocs

Click here for javadocs.

Download Java Client Library

Download the Java client library which uses Auth Token for authentication from the link below. It is recommended to use this library.

http://css.zohostatic.com/db/api/v4_m1/ZohoReportAPIClient.zip

Download the Java client library which uses Ticket for authentication from the link below. It is not recommended to use this library. Instead, it is recommended to use the library which supports Auth Token. New features / New APIs will not be supported in this library. This will be available temporarily as a reference for existing API users who uses this library and will soon be removed.

http://css.zohostatic.com/db/api/v3_0/m9/ZohoReportAPIClient.zip

Samples

Samples are bundled along with the client jars in the above ZIP download. You can find them under the samples folder

For using the samples
  • Take a copy of the Store Sales database.
  • Change the configurations in Config.java
  • Compile the files using CompileSamples.bat (/CompileSamples.sh)
  • Test the samples using TestSamples.bat (/TestSamples.sh).

Available samples

Python-Client-Library :: Version3.4

$
0
0

Python Library

The Python client libraries wraps the raw HTTP based API of Zoho Reports with easy to use methods for Python language. This enables Python developers to easily use Zoho Reports API.

Pythondocs

Click here for pythondocs. (Note: The main class is ReportClient).

Download Python Client Library

Download the Python client library which uses Auth Token for authentication from the link below. It is recommended to use this library.

http://css.zohostatic.com/db/api/v4_m1/ZohoReportPythonLib.zip

Download the Python client library which uses Ticket for authentication from the link below. It is not recommended to use this library. Instead, it is recommended to use the library which supports Auth Token. New features / New APIs will not be supported in this library. This will be available temporarily as a reference for existing API users who uses this library and will soon be removed.

http://css.zohostatic.com/db/api/v3_0/m4/ZohoReportPythonLib.zip


Deprecation Note


Usage of Ticket in API requests is deprecated. Users are strongly recommended to use Auth Token instead of Ticket in your API requests, as support for Ticket will be removed in the near future.


Samples

A sample, named Sample.py, is bundled along with python client library in the above ZIP download.

For using the sample
  • Take a copy of the Store Sales database.
  • Change the configurations in Config class in the Sample.py

Client-Libraries :: Version2.2

CSharp-Client-Library :: Version1.2

$
0
0

C# Library

The C# client libraries wraps the raw HTTP based API of Zoho Reports with easy to use methods for the C# .Net platform. This enables C# .Net developers to easily use Zoho Reports API.



Prerequisites:

It is recommend to go through the Zoho Reports API Documentation and the Prerequisites before using the C# client library code in your application.

Download C# Client Library:

Download the C# client library (dll) from the following links. 

Add reference to your C# Projects using these .dll files. With this you will be able to perform Zoho Reports API operations using the available functions.

Methods Summary:

C# .Net developers need to create a ReportClient  object to access the below functions. The sample code snippet is below.

IReportClient RepClient = new ReportClient("-----your authtoken-----");

The ReportClient constructor has a single argument called AuthToken. You can find more information on how to get a AuthToken hereOnce the ReportClient object is created, you can invoke the below methods from your C# .Net programming language.

GetURI

public string GetURI(string userEmailId)

This function returns the URI for performing User Management API requests/operations

Parameters:
  • string userEmailId - The Primary Email Address of your Zoho Reports Account 

Returns:
The URI for performing user specific API operations



GetURI

public string GetURI(string AdminEmailId, string DatabaseName)

This function returns the URI for performing Zoho Reports Database specific API operations.

Parameters:
  • string AdminEmailId - The Primary Email Address of your Zoho Reports Account.
  • string DatabaseName - The Zoho Reports Database Name

Returns:
The URI for performing Zoho Reports Database specific API operations



GetURI

public string GetURI(string AdminEmailId, string DatabaseName, string ViewName)

This function returns the URI for performing Zoho Reports View specific API operations.

Parameters:
  • string AdminEmailId - The Primary Email Address of your Zoho Reports Account.
  • string DatabaseName - The Zoho Reports Database Name
  • string ViewName - The Zoho Reports View Name. This could be a chart, pivot table, summary view, table, query table or dashboard created in Zoho Reports.

Returns:
The URI for performing Zoho Reports View specific API operations



Import Data

public Dictionary<string,string> ImportData(string TableURI, string ImportType, string CSVFilePath, Dictionary<string, string> ImportConfig)

This function is used to Import data from a local CSV/TSV/Txt file into Zoho Reports Online Reporting Database Table. This function is referring to Zoho Reports Import API.

Parameters:
  • string TableURI  -  The URI of the Table, into which the data has to be imported, got from the GetURI function
  • string ImportType  -  The Import Type for the import process. This can be taken from ZohoReportsConstants file (which has all the constant variables used in this Library).
  • string CSVFilePath  -  The file path of your data file
  • Dictionary ImportConfig  -  This parameter holds the import parameters such as ZOHO_ON_IMPORT_ERROR, ZOHO_DATE_FORMAT, etc. You can check out the list of import parameters here.

Returns:
The import summary with summary name as Key and summary value as Value



Add Row

public Dictionary <string,string> AddRow(string TableURI, Dictionary<string,string> ColumnValues, Dictionary<string,string> Config)

This function is used to Add a row to a Zoho Reports Table. The row data present in the ColumnValues Dictionary will be added as a row in the specified Zoho Reports Table. This function uses the HTTP Zoho Reports Add Row API.

Parameters:
  • string TableURI  -  The URI of the table, into which the data is to be added, got from the GetURI function
  • Dictionary ColumnValues  -  The Dictionary of Column Names and Values. The Values are added to the respective columns specified in the columnValues Dictionary.
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.

Returns:
Added values with column name as Key and row value as Value



Update Data

public void UpdateData(string TableURI, Dictionary<string, string> ColumnValues, string Criteria, Dictionary<string, string> Config)

This function is used to Update Rows in a Zoho Reports Table which matches the specified criteria. If the criteria provided is null, then all the rows will be updated with the new values provided in ColumnValues Dictionary. This function uses the HTTP Zoho Reports Update Data API.

Parameters:
  • string TableURI  -  The URI of the table, in which the data is to be updated, got from the GetURI function
  • Dictionary ColumnValues  -  The Dictionary of Column Names and Values. The Values are updated to the respective columns specified in the columnValues Dictionary.
  • string Criteria  -  Criteria for updating rows. The rows matching the specified criteria alone will get updated. The criteria follows the SQL SELECT WHERE condition like format. More details on specifying Zoho Criteria is available in Applying Filters section.
  • Dictionary Config - The Dictionary for sending extra parameters, if any.



Delete Data

public void DeleteData(string TableURI, string Criteria, Dictionary<string, string> Config)

This function is used to Delete the Rows in a Zoho Reports Table which matches the specified criteria. If the criteria provided is null, then all the rows will be deleted. This function uses the HTTP Zoho Reports Delete Data API.

Parameters:
  • string TableURI  -  The URI of the table, in which the data is to be deleted, got from the GetURI function
  • string Criteria  -  Criteria for deleting rows. The rows matching the specified criteria alone will get deleted. The criteria follows the SQL SELECT WHERE condition like format. More details on specifying Zoho Criteria is available in Applying Filters section.
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.



Export Data As JSON

public string ExportDataAsJSON(string ViewURI, string Criteria, Dictionary<string, string> Config)

This function is used to Export the data from a Zoho Reports Table / Report in a JSON format. This function uses the HTTP  Zoho Reports Export API.

Parameters:
  • string ViewURI  -  The URI of the view, from which the data is to be exported, got from the GetURI function
  • string Criteria  -  Criteria for exporting data. The rows matching the specified criteria alone will get exported. The criteria follows the SQL SELECT WHERE condition like format. More details on specifying Zoho Criteria is available in Applying Filters section.
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.

Returns:
The JSON string which contains the exported data



Export Data As CSV

public string ExportDataAsCSV(string ViewURI, string Criteria, Dictionary<string, string> Config)

This function is used to Export the data from a Zoho Reports Table / Report in a CSV format. This function uses the HTTP  Zoho Reports Export API.

Parameters:
  • string ViewURI  -  The URI of the view, from which the data is to be exported, got from the GetURI function
  • string Criteria  -  Criteria for exporting data. The rows matching the specified criteria alone will get exported. The criteria follows the SQL SELECT WHERE condition like format. More details on specifying Zoho Criteria is available in Applying Filters section.
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.

Returns:
The CSV string which contains the exported data



Export Data As File

public void ExportData(string ViewURI, string Format, String OutputFileName, string Criteria, Dictionary<string, string> Config)

This function is used to export the Zoho Reports Table / Report / Dashboard data in the name of the specified file. This function uses the HTTP  Zoho Reports Export API.

Parameters:
  • string ViewURI  -  The URI of the view, from which the data is to be exported, got from the GetURI function
  • string Format   -   The output format for exporting the data. The supported formats are CSV, XML, JSON, HTML, PDF, IMAGE.
  • string OutputFileName  -  The data will be exported to the specified  output file in the local machine.
  • string Criteria  -  Criteria for exporting data. The rows matching the specified criteria alone will get exported. The criteria follows the SQL SELECT WHERE condition like format. More details on specifying Zoho Criteria is available in Applying Filters section.
  • Dictionary Config - The Dictionary for sending extra parameters, if any.



Export Data As Stream

public void ExportData(string ViewURI, string Format, Stream outputStream, string Criteria, Dictionary<string, string> Config)

This function is used to export the Zoho Reports Table / Report / Dashboard data in the specified Output Stream. This function uses the HTTP Zoho Reports Export API.

Parameters:
  • string ViewURI  - The URI of the view, from which the data is to be exported, got from the GetURI function
  • string Format   -   The output format for exporting the data. The supported formats are CSV, XML, JSON, HTML, PDF, IMAGE.
  • Stream OutputStream  -  The output stream to which the data has to be exported.
  • string Criteria  -  Criteria for exporting data. The rows matching the specified criteria alone will get exported. The criteria follows the SQL SELECT WHERE condition like format. More details on specifying Zoho Criteria is available in Applying Filters section.
  • Dictionary Config - The Dictionary for sending extra parameters, if any.



Export Data As Dictionary

public Dictionary<string,object> ExportDataAsDictionary(string ViewURI, string Criteria, Dictionary<string, string> Config)

This function is used to export the Zoho Reports Table / Report data as C# Dictionary object. You can then parse this object to retrieve the resultant data. This function uses the HTTP  Zoho Reports Export API.

Parameters:
  • string ViewURI  -  The URI of the view, from which the data is to be exported, got from the GetURI function
  • string Criteria  -  Criteria for exporting data. The rows matching the specified criteria alone will get exported. The criteria follows the SQL SELECT WHERE condition like format. More details on specifying Zoho Criteria is available in Applying Filters section.
  • Dictionary Config - The Dictionary for sending extra parameters, if any.

Returns:
It returns Dictionary<string,object> containing the data. You can iterate this object to get the result. The sample resultant Dictionary will be as below.

Key<string>: column_order
Value<Object[]>: ["column1","column2",..,"columnN"]

Key<string>: rows
Value<Object[]>: [ [value11,value12,..,value1N],[value21,valuu22,..,value2N] ]



Export Data Using SQL As File

public void ExportData(string ViewURI, string Format, String OutputFileName, string SQLQuery, Dictionary<string, string> Config)

This function is used to export the Table data got by executing the given SQL SELECT Query in your Zoho Reports database. This function uses the HTTP Zoho Reports Cloud SQL API Specification.

Parameters:
  • string ViewURI  -  The URI of the view, from which the data is to be exported, got from the GetURI function
  • string Format   -   The output format for exporting the data. The supported formats are CSV, XML, JSON, HTML, PDF, IMAGE.
  • string OutputFileName  -  The data will be exported to the specified  output file in the local machine
  • string SQLQuery  -  The SQL SELECT Query which has to be executed to fetch the result set that is to be executed
  • Dictionary Config - The Dictionary for sending extra parameters, if any.



Export Data Using SQL As Stream

public void ExportData(string ViewURI, string Format, Stream outputStream, string SQLQuery, Dictionary<string, string> Config)

This function is used to export the Table data got by executing the given SQL SELECT Query in your Zoho Reports database. The data will exported into the specified output stream. This function uses the Zoho Reports Cloud SQL API Specification.

Parameters:
  • string ViewURI  -  The URI of the view, from which the data is to be exported, got from the GetURI function
  • string Format   -   The output format for exporting the data. The supported formats are CSV, XML, JSON, HTML, PDF, IMAGE.
  • Stream OutputStream  -  The output stream to which the data has to be exported.
  • string SQLQuery  -  The SQL SELECT Query which has to be executed to fetch the result set that is to be executed
  • Dictionary Config - The Dictionary for sending extra parameters, if any.



Meta Data

public string GetDatabaseMetaData(string DatabaseURI, string MetaData, string format, Dictionary<string, string> Config)

This function is used to get the Zoho Reports Database Metadata in the specified format (XML / JSON). You can then parse this XML / JSON to retrieve the resultant data.

Parameters:
  • string DatabaseURI - The corresponding Zoho Reports Database URI got from the GetURI function
  • string MetaData  -  The metadata type which can be got from ZohoReportsConstants file.
  • string format - The response format for the metadata. The supported formats are XML and JSON.
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.

Returns:
The meta data  will be returned as an XML / JSON (based on the specified format) which you can parse to get the meta data.



Get Copy DB Key

public string GetCopyDBKey(string DatabaseURI, Dictionary<string, string> Config)

This function is used to get the Copy Database Key. This key will be required in CopyDatabase function for copying the database.

Parameters:
  • string DatabaseURI - The corresponding Zoho Reports Database URI got from the GetURI function
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.

Returns:
The Copy Database Key for the specified database in the DatabaseURI



Copy Database

public long CopyDatabase(string DatabaseURI, string NewDBName, string NewDBDescription, bool WithData, string CopyDBKey, Dictionary<string,string> Config)

This function is used to copy the database in your Zoho Reports Account. The database will be copied, if the CopyDBKey is valid.

Parameters:
  • string DatabaseURI - The URI of the Zoho Reports Database to be copied, got from the GetURI function
  • string NewDBName - The Database Name for the newly copied database
  • string NewDBDescription  -  The Description for the newly copied database
  • bool WithData  -  If true, the database will be copied along with data, else the database will be copied without data
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.

Returns:
The Database ID for the newly copied database



Delete Database

public void DeleteDatabase(string AccountURI, string DatabaseName, Dictionary<string, string> Config)

This function is used to delete a database from your Zoho Reports Account.

Parameters:
  • string AccountURI - Your Zoho Reports Account URI got from the GetURI function
  • string DatabaseName  -  The name of the database to be deleted



Add User

public void AddUser(string AccountURI, string EmailIds, Dictionary<string, string> Config)

This function is used to Add one or more users to your Zoho Reports Account. The added users will be associated to the Administrator's Zoho Reports Account. This function does not Sign Up the user in Zoho, if the added user does not exists in Zoho. By default all the new users added will be set to Active state, and will be counted into Zoho Reports account user limit.

Parameters:
  • string AccountURI  -  Your Zoho Reports  AccountURI got from GetURI function
  • string EmailIds  -  The Zoho primary email addresses of the users to be added, separated by comma (,)
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.



Remove User

public void RemoveUser(string AccountURI, string EmailIds, Dictionary<string, string> Config)

This function is used to Remove one or more users from your Zoho Reports Account. This action does not remove the user from Zoho, just removes the association of that user in your Zoho Reports account. 

Parameters:
  • string AccountURI  -  Your Zoho Reports AccountURI got from GetURI function
  • string EmailIds  -  The Zoho primary email addresses of the users to be removed, separated by comma (,)
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.



Activate User

public void ActivateUser(string AccountURI, string EmailIds, Dictionary<string, string> Config)

This function is used to Activate one or  more users in your Zoho Reports Account.

Parameters:
  • string AccountURI  -  Your Zoho Reports AccountURI got from GetURI function
  • string EmailIds  -  The Zoho primary email addresses of the users to be activated, separated by comma (,)
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.



De-Activate User

public void DeActivateUser(string AccountURI, string EmailIds, Dictionary<string, string> Config)

This function is used to Deactivate one or more users in your Zoho Reports Account.

Parameters:
  • string AccountURI  - Your Zoho Reports AccountURI got from GetURI function
  • string EmailIds  -  The Zoho primary email addresses of the users to be de-activated, separated by comma (,)
  • Dictionary Config  -  The Dictionary for sending extra parameters, if any.



Set Web Proxy

public void SetWebProxy(string host, int port, string user, string password)

This function is used to set the proxy details if your network uses proxy.

Parameters:
  • string host  -  The host name or IP Address of your proxy host
  • int port  -  The port number for connecting your proxy
  • string user  -  The username for authenticating to your proxy
  • string password  -  The password for authenticating to your proxy



ZohoReportsConstants:

This C# client library has a sealed class called ZohoReportsConstants. This class has the list of constants used in this library. The available constants are below.

Constants used in GetDatabaseMetaData function:

  • ZOHO_CATALOG_LIST - To list the Zoho Reports databases for the specified user
  • ZOHO_CATALAOG_INFO - To fetch information about the tables & reports (view) present in the given reporting database in Zoho Reports. 
  • ZOHO_DATATYPES - To get the list of datatypes supported by Zoho Reports
  • ZOHO_TABLETYPES - Various view types available in Zoho Reports

Constants used in ImportData function:

  • APPEND - Appends the data into the table
  • TRUNCATEADD - Deletes all existing rows in the table and adds the imported data as a new entry
  • UPDATEADD - Updates the row if the mentioned column values (in ZOHO_MATCHING_COLUMNS parameter) are matched, else a new entry will be added


Sample Program:

The below sample program illustrates how to invoke Zoho Reports API using Zoho Reports C# client library.

The program steps are classified as follow.



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZReports;  // Namespace which contains classes for invoking Zoho Reports APIs

namespace MyZohoReportsClient
{
    class MyJob
    {

        /*
          Creating ReportClient object for invoking Zoho Reports APIs
        */
        public IReportClient getClient()
        {
            // Creating ReportClient Object using Auth Token
            // ReportClient class contains all the supported API operations as functions
            IReportClient RepClient = new ReportClient("---your_authtoken_here---");
            return RepClient;
        }

        /*
 
          The following method uses Zoho Reports IMPORT API to import the data from a local file into Zoho Reports Table. 
          This method illustrates importing data from the location "C:\workspace\mydata.csv" into the table named "MyTable1" in "MyDB" reporting database. 
          The usage of Import API is described below.
 

          IMPORT API:
          The IMPORT API allows you to import the data from your local file into Zoho Reports Table.

          Zoho Reports C# Library Function:
          ImportData(string tableURI, string ImportType, string FilePath, Dictionary<string,string> ImportConfig)

          Parameters:
             string tableURI
             This is the URI for the Zoho Reports Table into which the data has to be imported.
             Get the tableURI from GetURI(emailId,databaseName,tableName) function.
             The GetURI function will get your email address, the Zoho Reports Database Name and Zoho Reports Table Name as parameters.

             string ImportType
             This specifies how to import data. The Import type parameter can be set to APPEND, TRUNCATEADD or UPDATEADD. These constants can be set from ZohoReportsConstants class
             To know more about the Import Types, refer the Zoho Reports Import API Parameters section.

             string FilePath
             The location of the file which needs to be imported into Zoho Reports. The Import API will read the data from the file specified in this parameter and uploads the same
             into Zoho Reports Table.

             Dictionary<string,string> ImportConfig
             Dictionary to specify the additional Import Parameters. This Dictionary has the Parameter Name as Key and Parameter Value as Value.
 
          This ImportData function returns the Import Summary as a Dictionary

        */

        public void importData(IReportClient RepClient)
        {
            string tableURI = RepClient.GetURI("testuser@zoho.com", "MyDB", "MyTable1");
            Dictionary<string, string> ImportConfig = new Dictionary<string, string>();
            ImportConfig.Add("ZOHO_ON_IMPORT_ERROR", "ABORT");
            Dictionary<string, string> ImportRes = RepClient.ImportData(tableURI, ZohoReportsConstants.APPEND, "C:\\workspace\\mydata.csv",ImportConfig);
        }

        /*
 
          The following method uses Zoho Reports ADDROW API to add a single row into the Zoho Reports Table. 
          This method illustrates adding a single row to the table "MyTable1" in "MyDB" database. This table consists of a single column named "Region" 
          The usage of AddRow API is described below.
 

          ADDROW API:
          The ADDROW API allows you to add a single row into the specified Zoho Reports table.

          Zoho Reports C# Library Function:
          AddRow(string tableURI,Dictionary<string,string> ColumnValues,Dictionary<string,string> Config)

          Parameters:
             string tableURI
             This is the URI for the Zoho Reports Table into which the data has to be imported.
             Get the tableURI from GetURI(emailId,databaseName,tableName) function.
             The GetURI function will get your email address, the Zoho Reports Database Name and Zoho Reports Table Name as parameters.

             Dictionary<string,string> ColumnValues
             The Dictionary which has Zoho Reports Table Column Name as Key and Column Value as Value. 
             All the entries in the ColumnValues Dictionary will be added as a Row in the specified table in the tableURI

             Dictionary<string,string> Config
             Useful for sending additional parameters, if any. This Dictionary has the Parameter Name as Key and Parameter Value as Value.
 
          This AddRow function returns the added values as a Column Name vs. Column Value Dictionary

        */

        public void addRow(IReportClient RepClient)
        {
            string tableURI = RepClient.GetURI("testuser@zoho.com", "MyDB", "MyTable1");
            Dictionary<string, string> ColumnValues = new Dictionary<string, string>();
            ColumnValues.Add("Region", "South");
            Dictionary<string, string> addRowRes = RepClient.AddRow(tableURI, ColumnValues, config);
        }



        /*
 
          The following method uses Zoho Reports UPDATE API to update rows in Zoho Reports Table. 
          This method illustrates updating the value 'South' with 'North' for the column "Region" in the Zoho Reports table "MyTable1" in "MyDB" database.
          The usage of UpdateData API is described below.
 

          UPDATE API:
          The data present in a Zoho Reports Table can be updated using Zoho Reports UPDATE API.

          Zoho Reports C# Library Function:
          UpdateData(string tableURI, Dictionary<string,string> ColumnValues, string criteria, Dictionary<string,string> Config)

          Parameters:
             string tableURI
             This is the URI for the Zoho Reports Table into which the data has to be updated.
             Get the tableURI from GetURI(emailId,databaseName,tableName) function.
             The GetURI function will get your email address, the Zoho Reports Database Name and Zoho Reports Table Name as parameters.

             Dictionary<string,string> ColumnValues
             The Dictionary which has Zoho Reports Table Column Name as Key and Column Value as Value. 
             All the entries in the ColumnValues Dictionary will be updated in the specified table in the tableURI

             string criteria
             Criteria for updating data. The rows matching this criteria alone will get updated. 
             The criteria should follow the same format as that of the SQL WHERE clause.
             To know more about specifying criteria, refer the Applying Filters section in Zoho Reports API Documentation.

             Dictionary<string,string> Config
             Useful for sending additional parameters, if any. This Dictionary has the Parameter Name as Key and Parameter Value as Value.
 
          This UpdateData function will not return any object.
         */
        public void updateRow(IReportClient RepClient)
        {
            string tableURI = RepClient.GetURI("testuser@zoho.com", "MyDB", "MyTable1");
            Dictionary<string, string> ColumnValues = new Dictionary<string, string>();
            ColumnValues.Add("Region", "North");
            string criteria = "\"Region\"='South'";
            RepClient.UpdateData(tableURI, ColumnValues, criteria, null);
        }



        /*
 
          The below method uses Zoho Reports DELETE API to delete rows in Zoho Reports Table. 
          In this method, the rows matching value 'South' in column Region is deleted from the table MyTable1 in MyDB database.
          The usage of DeleteData API is described below.
 

          DELETE API:
          The data present in a Zoho Reports Table can be deleted using Zoho Reports DELETE API.

          Zoho Reports C# Library Function:
          DeleteData(string tableURI, string criteria, Dictionary<string,string> Config)

          Parameters:
             string tableURI
             This is the URI for the Zoho Reports Table into which the data has to be deleted.
             Get the tableURI from GetURI(emailId,databaseName,tableName) function.
             The GetURI function will get your email address, the Zoho Reports Database Name and Zoho Reports Table Name as parameters.
             string criteria
             Criteria for deleting data. The rows matching this criteria alone will get deleted. 
             The criteria should follow the same format as that of the SQL WHERE clause.
             To know more about specifying criteria, refer to the Applying Filters section in Zoho Reports API Documentation.

             Dictionary<string,string> Config
             Useful for sending additional parameters, if any. This Dictionary has the Parameter Name as Key and Parameter Value as Value.
 
          This DeleteData function will not return any object.

        */
        public void deleteRow(IReportClient RepClient)
        {
            string tableURI = RepClient.GetURI("testuser@zoho.com", "MyDB", "MyTable1");
            string criteria = "\"Region\"='South'";
            RepClient.DeleteData(tableURI, criteria, null);
        }



        /*
 
          The following method uses Zoho Reports EXPORT API to Export data from a Zoho Reports Table or Report. 
          This method illustrates exporting the data matching value 'West' in column "Region" from the Zoho Reports Table "MyTable1" in "MyDB" database.
          The usage of Export API is described below.
 

          EXPORT API:
          The data present in a Zoho Reports Table or Report can be exported using Zoho Reports EXPORT API.

          Zoho Reports C# Library Function:
          ExportDataAsObject(string tableOrReportURI, string criteria, Dictionary<string,string> Config)

          Parameters:
             string tableOrReportURI
             This is the URI for the Zoho Reports Table or Report from which the data has to be exported.
             Get the tableOrReportURI from GetURI(emailId,databaseName,tableNameOrReportName) function.
             The GetURI function will get your email address, the Zoho Reports Database Name and Zoho Reports Table Name as parameters.
             string criteria
             Criteria for exporting data. The rows matching this criteria alone will get exported. 
             The criteria should follow the same format as that of the SQL WHERE clause.
             To know more about specifying criteria, refer to the Applying Filters section in Zoho Reports API Documentation.

             Dictionary<string,string> Config
             Useful for sending additional parameters, if any. This Dictionary has the Parameter Name as Key and Parameter Value as Value.
 
          This ExportDataAsObject function will return an object which can be iterated to get the result.
         */
        public object export(IReportClient RepClient)
        {
            string tableURI = RepClient.GetURI("testuser@zoho.com", "MyDB", "MyTable1");
            Dictionary<string, object> resObj = RepClient.ExportDataAsDictionary(tableURI, "\"Region\"='West'", null);
Object[] columns = (Object[])resObj["column_order"];
Object[] rows = (Object[])resObj["rows"];
 } public static void Main(string[] s) { MyJob myJob = new MyJob(); IReportClient rc = myJob.getClient(); myJob.importData(rc); myJob.addRow(rc); myJob.updateRow(rc); myJob.deleteRow(rc); myJob.export(rc); Console.Read(); } } }

Updating-Data :: Version4.8

$
0
0

Updating Data




1. It is mandatory to use HTTPS in all API requests instead of HTTP request. HTTP is not supported

2. Always use https://reportsapi.zoho.com as the API request URL.

The data present in a table can be updated using this API.

Sample

A sample request that updates the salary to 10000 and perks to 6000 and deduction to Empty (no value) for all employees of the finance department.

URL
https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB/EmployeeDetails?ZOHO_ACTION=UPDATE&ZOHO_OUTPUT_FORMAT=XML
&ZOHO_ERROR_FORMAT=XML&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0

Data Sent as POST parameters.
Salary=10000&Deduction=&Perks=6000&ZOHO_CRITERIA=(%22Department%22%3D'Finance')

ZOHO_CRITERIA is encoded in URL encoding format. Value without encoding is given below:

ZOHO_CRITERIA=("Department" = 'Finance')

 Note


It is recommended to use Zoho Reports Login Email Address in the API URL instead of Zoho Username.

Specifying the action

In the query string of the URL , the ZOHO_ACTION parameter should be "UPDATE". For explanation about other mandatory query string parameters such as ZOHO_OUTPUT_FORMAT, refer this link.

Note: Value of ZOHO_ACTION parameter should be in the same case(UPPER CASE) as given in this document.

Specifying the data to be updated

Pass the columns whose values you would like to update in a <columnname>=<value> format. (The parameters should be in application/x-www-form-urlencoded format).

<columnname> - Refers to the name of the column in the table whose value is to be updated
<value> - Refers to the corresponding value to be updated in the column

For specifying empty (null) values, the parameter should be sent with empty values. In the example above, the Deduction value is taken to be empty.

Criteria

If the ZOHO_CRITERIA parameter is not sent, then all the rows are updated. If criteria is sent the rows matching the criteria alone are updated. For more details about the format for the criteria view this link.

Sample Success Response

The following code snippets provides the response in XML and JSON formats for the sample referred above.

XML

<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/api/abc@zoho.com/EmployeeDB/EmployeeDetails" action="UPDATE">
<criteria>&quot;Department&quot; = &apos;Finance&apos;</criteria>
<result>

<updatedColumns>
<column>Salary</column>
<column>Deduction</column>
<column>Perks</column>
</updatedColumns>
<updatedRows>4</updatedRows>

</result>
</response>

JSON

{
"response":
{
"uri": "/api/abc@zoho.com/EmployeeDB/EmployeeDetails",
"action": "UPDATE",
"criteria": "\"Department\" = 'Finance'",
"result":
{
"updatedColumns":["Salary","Deduction","Perks"],
"updatedRows":"4"
}
}
}

Deleting-Data :: Version5

$
0
0

Deleting Data




1. It is mandatory to use HTTPS in all API requests instead of HTTP request. HTTP is not supported

2. Always use https://reportsapi.zoho.com as the API request URL.


The data present in a table can be deleted using this API.

Sample

A sample request that deletes the records of all the employees in finance department.

URL

https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB/EmployeeDetails?ZOHO_ACTION=DELETE
&ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML
&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0

Data Sent as POST parameters.

&ZOHO_CRITERIA=(%22Department%22%3D'Finance')

ZOHO_CRITERIA is encoded for the URL format. The values without encoding is given below:

ZOHO_CRITERIA=("Department" = 'Finance')


Note


It is recommended to use Zoho Reports Login Email Address in the API URL instead of Zoho Username.

Specifying the action

In the query string of the URL, the ZOHO_ACTION parameter should be "DELETE". For explanation about other mandatory query string parameters such as ZOHO_OUTPUT_FORMAT, refer this link.

Note: Value of ZOHO_ACTION parameter should be in the same case(UPPER CASE) as given in this document.

Criteria

If the ZOHO_CRITERIA parameter is not sent, then all the rows are deleted. If criteria is sent then the rows matching the criteria alone are deleted. Please view this link for more details about the format for ZOHO_CRITERIA.

Sample Success Response

The following code snippets provides the response in XML and JSON formats for the sample refered above.

XML

<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/api/abc@zoho.com/EmployeeDB/EmployeeDetails" action="DELETE">
<criteria>&quot;Department&quot; = &apos;Finance&apos;</criteria>
<result>
<message>Deleted rows</message>
<deletedrows>4</deletedrows>
</result>
</response>

JSON

{

"response":
{
"uri": "/api/abc@zoho.com/EmployeeDB/EmployeeDetails",
"action": "DELETE",
"criteria": "\"Department\" = \'Finance\'",
"result":
{
"message": "Deleted rows",
"deletedrows":"4"
}
}
}


Export :: Version7.2

$
0
0

Export



1. It is mandatory to use HTTPS in all API requests instead of HTTP request. HTTP is not supported

2. Always use https://reportsapi.zoho.com as the API request URL.

Using this API users can export/pull data from tables or reports (pivots, charts etc.,) in different formats.

Sample

Exports the records of all the employees in the finance department in CSV Format.

URL
https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB/EmployeeDetails?ZOHO_ACTION=EXPORT
&ZOHO_OUTPUT_FORMAT=CSV&ZOHO_ERROR_FORMAT=XML
&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0

Additional Control Parameters Sent as POST parameters

&ZOHO_CRITERIA=(%22Department%22%3D'Finance')&ZOHO_DELIMITER=0

ZOHO_CRITERIA is encoded for the url format. Value without encoding is below:

ZOHO_CRITERIA=("Department" = 'Finance')

 Note

It is recommended to use Zoho Reports Login Email Address in the API URL instead of Zoho Username.

Query String Parameters

In the query string of the URL include the following parameters

  • ZOHO_ACTION parameter should be "EXPORT".

    Note:
    Value of ZOHO_ACTION parameter should be in the same case(UPPER CASE) as given in this document.

  • ZOHO_OUTPUT_FORMAT should be the required format. The supported formats are
    • CSV
    • XML
    • JSON
    • HTML
    • PDF
    • IMAGE (applicable only for Charts)

For explanation about other mandatory query string parameters such as ZOHO_ERROR_FORMAT, refer to this link.

Criteria

If the ZOHO_CRITERIA parameter is not sent, then all the rows are exported. If criteria is sent the rows matching the criteria alone are exported. For more details about the format for the criteria refer this link.

Response Formats

CSV Format

To export in CSV format, in query parameters, the value for ZOHO_OUTPUT_FORMAT should be CSV

Additional parameters (preferably to be sent in the body of the POST request).

Parameter
Possible Values
Description
ZOHO_OUTPUT_FORMAT CSV
ZOHO_DELIMITER Value between 0 - 3
0 - COMMA
1 - TAB
2 - SEMICOLON
3 - SPACE
The delimiter character used for separating the fields in a row in the CSV.
ZOHO_RECORD_DELIMITER Value between 0 - 2
0 - DOS
1 - UNIX
2 - MAC
The record delimiter (newline character) to use.
ZOHO_QUOTED Value between 0 - 1
0 - SINGLE
1 - DOUBLE
The quote character to use for quoting the values.
ZOHO_INCLUDE_HEADER true / false

true - To include the column names in the first row of the CSV exported.

false - To not include the column names in the CSV exported.

ZOHO_SHOW_HIDDENCOLS true / false

Controls where the columns that have been hidden in the table/report have to be exported.

true - To include the hidden columns of the table/report in the data exported

false - To not include the hidden columns of the table/report in the data exported.


Sample Success Response:

The following is a sample Export of data in a Table, in CSV format:

"Name","Department","Date Of Birth"
"John","Finance","12 May 1972"
"Joan","Admin","15 June 1975"


JSON Format

To export in JSON format, in query parameters, the value for ZOHO_OUTPUT_FORMAT should be JSON

Additional parameters (preferably to be sent in the body of the POST request).

Parameter
Possible Values
Description
ZOHO_SHOW_HIDDENCOLS true / false

Controls where the columns that have been hidden in the table/report have to be exported.

true - To include the hidden columns of the table/report in the data exported

false - To not include the hidden columns of the table/report in the data exported.

ZOHO_CALLBACK_FUNCTION Name of the json callback function Processes JSON response elsewhere in the JavaScript code on the page

Sample Success Response:

The following is a sample Export of data in a Table, in JSON format:

{ 

"response":
{
"uri": "/api/abc@zoho.com/EmployeeDB/EmployeeDetails",
"action": "EXPORT",
"result":
{
"column_order":["Name","Department","Date Of Birth"],
"rows":[
["John","Finance","12 May 1972"],
["Joan","Admin","15 June 1975"]
]
}
}
}

XML Format

To export in XML format, in query parameters, the value for ZOHO_OUTPUT_FORMAT should be XML

Additional parameters (preferably to be sent in the body of the POST request).

Parameter
Possible Values
Description
ZOHO_SHOW_HIDDENCOLS true / false

Controls where the columns that have been hidden in the table/report have to be exported.

true - To include the hidden columns of the table/report in the data exported

false - To not include the hidden columns of the table/report in the data exported.

Sample Success Response:

The following is a sample Export of data in a Table, in XML format

<?xml version="1.0" encoding="UTF-8" ?>
<response uri="/api/abc@zoho.com/EmployeeDB/EmployeeDetails" action="EXPORT">
<result>
<rows>
<row>

<column name="Name">Gary</column>
<column name="Date Of Birth">12-Jun-1980</column>
<column name="Basic">10000</column>
<column name="Country">USA</column>
</row>
<row>

<column name="Name">John</column>
<column name="Date Of Birth">12-Jun-1981</column>
<column name="Basic">10000</column>
<column name="Country">Canada</column>
</row>
<row>

<column name="Name">Joan</column>
<column name="Date Of Birth">12-Jun-1982</column>
<column name="Basic">10000</column>
<column name="Country">Mexico</column>
</row>
</rows>
</result>
</response>


HTML Format

To export in HTML format, in query parameters, the value for ZOHO_OUTPUT_FORMAT should be HTML

Additional parameters (preferably to be sent in the body of the POST request).

Parameter
Possible Values
Description
ZOHO_SHOW_HIDDENCOLS true / false

Controls where the columns that have been hidden in the table/report have to be exported.

true - To include the hidden columns of the table/report in the data exported

false - To not include the hidden columns of the table/report in the data exported.


PDF Format

To export in PDF format, in query parameters, the value for ZOHO_OUTPUT_FORMAT should be PDF

Additional parameters (preferably to be sent in the body of the POST request).

Parameter
Possible Values
Description
ZOHO_PAPERSIZE Value between 0 - 5
0 - LETTER
1 - LEGAL
2 - TABLOID
3 - A3
4 - A4
5 - AUTO
The size of the paper.
ZOHO_SHOW_TITLE Value between 0 - 2
0 - AT TOP
1 - AT BOTTOM
2 - NONE
Controls the title positioning.
ZOHO_SHOW_DESC Value between 0 - 2
0 - AT TOP
1 - AT BOTTOM
2 - NONE
Controls the description positioning.
ZOHO_EXPORT_LANGUAGE Value between 0 - 4
0 - ENGLISH
1 - EUROPEAN
2 - CHINESE
3 - JAPANESE
4 - KOREAN
Default - ENGLISH
PDF will be rendered using the specified language
ZOHO_PAPERSTYLE Portrait / Landscape
ZOHO_SHOW_HIDDENCOLS true / false

Controls where the columns that have been hidden in the table/report have to be exported.

true - To include the hidden columns of the table/report in the data exported

false - To not include the hidden columns of the table/report in the data exported.

ZOHO_SELECTED_COLUMNS List of comma separated column names Controls the column names that need to be exported. If it is not given then all the columns, in the table/report, are exported.
Margin Settings:
ZOHO_TOPMARGIN Decimal values between 0 to 1 The margin in inches for that edge. Can be decimal between 0 to 1 (like 0.5).
ZOHO_BOTTOMMARGIN
ZOHO_LEFTMARGIN
ZOHO_RIGHTMARGIN
Header/Footer Settings:
ZOHO_HEAD_LEFT Value between 0 - 5
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
The header or footer value that needs to be generated for each page at that particular position.
ZOHO_HEAD_RIGHT
ZOHO_HEAD_CENTER
ZOHO_FOOT_LEFT
ZOHO_FOOT_RIGHT
ZOHO_FOOT_CENTER
Custom Header/Footer value
ZOHO_HEAD_LEFT_TEXT Custom text. If any of the header/footer setting is 5 (.ie, CUSTOM) then the corresponding custom value/text should be passed.
ZOHO_HEAD_RIGHT_TEXT
ZOHO_HEAD_CENTER_TEXT
ZOHO_FOOT_LEFT_TEXT
ZOHO_FOOT_RIGHT_TEXT
ZOHO_FOOT_CENTER_TEXT


IMAGE Format

To export in IMAGE format, in query parameters, the value for ZOHO_OUTPUT_FORMAT should be IMAGE. You can only export Charts in Image format.

Additional parameters (preferably to be sent in the body of the POST request).

Parameter
Possible Values
Description
ZOHO_WIDTH <number> The width of the image .
ZOHO_HEIGHT <number> The height of the image
ZOHO_TITLE true / false

Controls whether the title of the report is to be added to the image.

true - Include the title.
false - Do not include title.

ZOHO_DESCRIPTION true/false

Controls whether the description of the report is to be added to the image.

true - Include the description.
false - Do not include description.

ZOHO_SHOWLEGEND true / false

Controls whether the legend is to be included in the image generated.

true - Include the legend in the image.
false - Do not include the legend in the image.

ZOHO_IMAGE_FORMAT png / jpg The format of the exported image. It could be either in PNG or JPG formats.


JSON Callbacks - JSONP
:

Zoho Reports API supports Callback function for handling API responses asynchronously. This is supported in Export API calls, when the output format is chosen as JSON.

The Export API method call, with JSON output format, supports an additional parameter called ZOHO_CALLBACK_FUNCTION to enable callback. Using the Callback function, developers can invoke the Export API request inside the <script> tag and process the JSON response using the CALLBACK function elsewhere in the JavaScript code on the page.

Example:

1. Define the callback function

<script>

function sampleFunction(resp)
{
var response = resp.response;
var result = response.result;
var rows = result.rows;
for(i=0;i<rows.length;i++)
{
var row = rows[i];
console.log(row);
...
}
...
}

</script>

2. Invoke the api request with output format as JSON and ZOHO_CALLBACK_FUNCTION=sampleFunction

 

<script src="">https://reportsapi.zoho.com/api/<loginemailaddress>/<DB>/<Table>?ZOHO_ACTION=EXPORT&ZOHO_OUTPUT_FORMAT=JSON&ZOHO_ERROR_FORMAT=XML&authtoken=<your auth token>&ZOHO_API_VERSION=1.0&ZOHO_CALLBACK_FUNCTION=sampleFunction">
</script>

 

When the page is loaded, the response will be returned as,

sampleFunction(
{
"response":
{
"uri": "/api/abc@zoho.com/EmployeeDB/EmployeeDetails",
"action": "EXPORT",
"result":
{
column_order:["Name","Department","Date Of Birth"],
rows:[
["John","Finance","12 May 1972"],
["Joan","Admin","15 June 1975"]
]
}
}
} );

Export Using SQL:

Zoho Reports has implemented the Zoho CloudSQL technology as an extension to its HTTP Web API. Using the  Zoho Reports HTTP API, users can query the database by providing SQL queries.

Refer to the documentation on  Zoho Reports CloudSQL for more details on how to use SQL SELECT query to fetch data from Zoho Reports.


MetaData :: Version7.7

$
0
0

Metadata




1. It is mandatory to use HTTPS in all API requests instead of HTTP request. HTTP is not supported

2. Always use https://reportsapi.zoho.com as the API request URL.

Using the APIs provided in this section you could get information about the databases and the reports created within it, in your Zoho Reports account. With the APIs provided you could get the following.

  • The list of Reporting databases in your account
  • Types of views available in Zoho Reports
  • Datatypes supported in Zoho Reports
  • The list of views in your database

Getting Metadata Using JDBC Driver

Zoho Reports has JDBC Driver and it can be used to fetch Zoho Reports'metadata. Refer to the page JDBC Driver for details.

Query String Parameters

In the query string of the URL include the following parameters.

  • ZOHO_ACTION parameter should be DATABASEMETADATA.
  • ZOHO_OUTPUT_FORMAT should be the required output format. The supported formats are
    • XML
    • JSON
  • ZOHO_METADATA specifies the information to be fetched. The supported values are:
    • ZOHO_CATALOG_LIST: To list the Zoho Reports' databases for a specified user
    • ZOHO_CATALOG_INFO: To fetch the Zoho Reports' information, including the tables and views present in the database.
    • ZOHO_DATATYPES: To get the data types supported by Zoho Reports
    • ZOHO_TABLETYPES: Various view types available in Zoho Reports

For explanation about other mandatory query string parameters such as ZOHO_ERROR_FORMAT, refer to this link.

Samples

The following listing shows samples for various METADATA request.


Getting Databases (Catalog) List

Sample request for fetching the databases (catalogs).

In the query string of the URL, the ZOHO_ACTION parameter should be DATABASEMETADATA and ZOHO_METADATA parameter should be ZOHO_CATALOG_LIST.

For other mandatory query string parameters such as ZOHO_OUTPUT_FORMAT, Refer to the Common parameters document for details.

Sample URL
https://reportsapi.zoho.com/api/abc@zoho.com?ZOHO_ACTION=DATABASEMETADATA&ZOHO_METADATA=ZOHO_CATALOG_LIST &ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML& authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0

 Note


It is recommended to use Zoho Reports Login Email Address in the API URL instead of Zoho Username.

Sample Responses

The following code snippets provides the response in JSON (ZOHO_OUTPUT_FORMAT=JSON) and XML (ZOHO_OUTPUT_FORMAT=XML)formats for the sample referred above.

XML Format

<RESPONSE URI="/api/abc@zoho.com" ACTION="ZOHO_CATALOG_LIST">
<ZCATALOGS>
<ZCATALOG IS_DEFAULT="1" TABLE_CAT="SalesDB"></ZCATALOG>
<ZCATALOG IS_DEFAULT="0" TABLE_CAT="Super Store Sales"></ZCATALOG>
<ZCATALOG IS_DEFAULT="0" TABLE_CAT="Project Manager"></ZCATALOG>
</ZCATALOGS>
</RESPONSE>

JSON Format

{
"response":
{
"uri": "\/api\/abc@zoho.com",
"action": "ZOHO_CATALOG_LIST",
"result":
[
{
"isDefault": true,
"tableCat": "SalesDB"
},
{
"isDefault": false,
"tableCat": "Super Store Sales"
},
{
"isDefault": false,
"tableCat": "Project Manager"
} 
]
}
}

Back to Samples| Back to Top


Getting Tables and Reports in the Database(Catalog Information)

Sample request for fetching the database information which includes the views present in the database, SalesDB.

In the query string of the URL, the ZOHO_ACTION parameter should be DATABASEMETADATA and ZOHO_METADATA parameter should be ZOHO_CATALOG_INFO.

For other mandatory query string parameters such as ZOHO_OUTPUT_FORMAT, Refer to the Common parameters for more details.


Sample URL
https://reportsapi.zoho.com/api/abc@zoho.com/SalesDB?ZOHO_ACTION=DATABASEMETADATA&ZOHO_METADATA=ZOHO_CATALOG_INFO &ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0

Sample Responses

The following code snippets provides the response in JSON (ZOHO_OUTPUT_FORMAT=JSON) and XML (ZOHO_OUTPUT_FORMAT=XML)formats for the sample referred above.

XML Format

<RESPONSE URI="/api/abc@zoho.com/SalesDB" ACTION="ZOHO_CATALOG_INFO">
<ZCATALOG TABLE_CAT="SalesDB">
<ZVIEW REMARKS="\N" TABLE_NAME="SalesTable" TABLE_TYPE="TABLE">
<ZCOLUMNS>
<ZCOLUMN
COLUMN_NAME="REGION" PKCOLUMN_NAME="\N" NULLABLE="true" COLUMN_SIZE="100"
PKTABLE_NAME
="\N" DATA_TYPE="12" REMARKS="\N" TYPE_NAME="Plain Text"
DECIMAL_DIGITS
="-1" ORDINAL_POSITION="1"></ZCOLUMN>
 .
.

.
<ZCOLUMN COLUMN_NAME="Order Date" PKCOLUMN_NAME="\N" NULLABLE="true" COLUMN_SIZE="19"
PKTABLE_NAME="\N" DATA_TYPE="93" REMARKS="\N" TYPE_NAME="Date"
DECIMAL_DIGITS
="-1" ORDINAL_POSITION="6"></ZCOLUMN>
</ZCOLUMNS></ZVIEW>
<ZVIEW REMARKS="\N" TABLE_NAME="Region" TABLE_TYPE="REPORT"></ZVIEW>
<ZVIEW REMARKS="\N" TABLE_NAME="SalesTabular" TABLE_TYPE="REPORT">
<ZVIEW REMARKS="\N" TABLE_NAME="SalesQuery" TABLE_TYPE="VIEW">
<ZCOLUMNS>
<ZCOLUMN COLUMN_NAME="Market Type" PKCOLUMN_NAME="\N" NULLABLE="false" COLUMN_SIZE="100"
PKTABLE_NAME
="\N" DATA_TYPE="12" REMARKS="\N" TYPE_NAME="Plain Text"
DECIMAL_DIGITS="-1" ORDINAL_POSITION="1"></ZCOLUMN>
.
.
.
<ZCOLUMN COLUMN_NAME="Order Date" PKCOLUMN_NAME="\N" NULLABLE="false" COLUMN_SIZE="19"
PKTABLE_NAME
="\N" DATA_TYPE="93" REMARKS="\N" TYPE_NAME="Date"
DECIMAL_DIGITS
="-1" ORDINAL_POSITION="2"></ZCOLUMN>
</ZCOLUMNS></ZVIEW>
<ZVIEW REMARKS="\N" TABLE_NAME="SalesPivot" TABLE_TYPE="REPORT"></ZVIEW>
<ZVIEW REMARKS="\N" TABLE_NAME="SalesSummary" TABLE_TYPE="REPORT"></ZVIEW>
</RESPONSE>

JSON Format

{
"response":
{
"uri": "\/api\/abc@zoho.com\/SalesDB",
"action": "ZOHO_CATALOG_INFO",
"result":
{
"views":
[

{
"remarks": null,
"tableName": "SalesTable",
"tableType": "TABLE",
"columns":
[
{
"columnName": "REGION",
"pkcolumnName": null,
"nullable": true,
"columnSize": 100,
"pktableName": null,
"dataType": "12",
"remarks": null,
"typeName": "Plain Text",
"decimalDigits": -1,
"ordinalPosition": 1
},
.
.
.
{
"columnName": "Order Date",
"pkcolumnName": null,
"nullable": true,
"columnSize": 19,
"pktableName": null,
"dataType": "93",
"remarks": null,
"typeName": "Date",
"decimalDigits": -1,
"ordinalPosition": 6
}
]
},

{
"remarks": "Region wise chart for the year 2009",
"tableName": "Region",
"tableType": "REPORT",
"columns":
[
]
},

{
"remarks": null,
"tableName": "SalesTabular",
"tableType": "REPORT",
"columns":
[
]
},

{
"remarks": null,
"tableName": "SalesQuery",
"tableType": "VIEW",
"columns":
[
{
"columnName": "Market Type",
"pkcolumnName": null,
"nullable": false,
"columnSize": 100,
"pktableName": null,
"dataType": "12",
"remarks": null,
"typeName": "Plain Text",
"decimalDigits": -1,
"ordinalPosition": 1
},

.
.
.
{
"columnName": "Order Date",
"pkcolumnName": null,
"nullable": false,
"columnSize": 19,
"pktableName": null,
"dataType": "93",
"remarks": null,
"typeName": "Date",
"decimalDigits": -1,
"ordinalPosition": 2
}
]
},

{
"remarks": null,
"tableName": "SalesPivot",
"tableType": "REPORT",
"columns":
[
]
},

{
"remarks": null,
"tableName": "SalesSummary",
"tableType": "REPORT",
"columns":
[
]
}
],
"tableCat": "SalesDB"
}
}
}

Back to Samples<| Back to Top

Getting Datatype Information

Sample request for obtaining the information about the datatypes supported in Zoho Reports.

In the query string of the URL, the ZOHO_ACTION parameter should be DATABASEMETADATA and ZOHO_METADATA parameter should be ZOHO_DATATYPES.

For other mandatory query string parameters such as ZOHO_OUTPUT_FORMAT, Refer to the Common parameters document to know more about this parameters.

Sample URL
https://reportsapi.zoho.com/api/abc@zoho.com?ZOHO_ACTION=DATABASEMETADATA&ZOHO_METADATA=ZOHO_DATATYPES &ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0

Sample Responses

The following code snippets provides the response in JSON (ZOHO_OUTPUT_FORMAT=JSON) and XML (ZOHO_OUTPUT_FORMAT=XML)formats for the sample referred above.

XML Format

<RESPONSE URI="/api/abc@zoho.com" ACTION="ZOHO_DATATYPES">
<ZDATATYPES>
<ZDATATYPE LITERAL_PREFIX="&apos;" MAXSIZE="19" MAXIMUM_SCALE="\N" NULLABLE="1"
TYPE_NAME
="Positive Number" DATA_TYPE="-5" MINIMUM_SCALE="\N" SQL_DATA_TYPE="-5"
FIXED_PREC_SCALE="false" LOCAL_TYPE_NAME="\N" AUTO_INCREMENT="false" ...
SQL_DATETIME_SUB="0" PRECISION="-1" UNSIGNED_ATTRIBUTE="true" ID="5"></ZDATATYPE>
 .
.
.
<ZDATATYPE LITERAL_PREFIX="&apos;" MAXSIZE="1" MAXIMUM_SCALE="\N" NULLABLE="1"
TYPE_NAME
="Yes/No Decision" DATA_TYPE="-7" MINIMUM_SCALE="\N" SQL_DATA_TYPE="-7"
FIXED_PREC_SCALE="false" LOCAL_TYPE_NAME="\N" AUTO_INCREMENT="false" ...
SQL_DATETIME_SUB="0" PRECISION="-1" UNSIGNED_ATTRIBUTE="false" ID="10"></ZDATATYPE>
</ZDATATYPES>
</RESPONSE>

JSON Format

{ "response": 
{
"uri": "\/api\/abc@zoho.com",
"action": "ZOHO_DATATYPES",
"result":
[

{
"literalPrefix": "\'",
"maxsize": 19,
"maximumScale": null,
"nullable": true,
"dataType": -5,
"minimumScale": null,
"sqlDataType": -5,
"fixedPrecScale": false,
"localTypeName": null,
"autoIncrement": false,
"searchable": false,
"literalSuffix": "\'",
"caseSensitive": true,
"numPrecRadix": "10",
"typeName": "Positive Number",
"createParams": "500",
"sqlDatetimeSub": "0",
"precision": -1,
"unsignedAttribute": true,
"id": "5"
},
 .
.
.

{
"literalPrefix": "\'",
"maxsize": 1,
"maximumScale": null,
"nullable": true,
"dataType": -7,
"minimumScale": null,
"sqlDataType": -7,
"fixedPrecScale": false,
"localTypeName": null,
"autoIncrement": false,
"searchable": false,
"literalSuffix": "\'",
"caseSensitive": true,
"numPrecRadix": "10",
"typeName": "Yes\/No Decision",
"createParams": "500",
"sqlDatetimeSub": "0",
"precision": -1,
"unsignedAttribute": false,
"id": "10"
}
]
}
}

Back to Samples| Back to Top


Table Types

Sample request for obtaining the view types (table &reports) supported in Zoho Reports.

In the query string of the URL, the ZOHO_ACTION parameter should be DATABASEMETADATA and ZOHO_METADATA parameter should be ZOHO_TABLETYPES. The following tables lists the common TABLETYPES

TABLE VIEW
REPORT
Tables
Query Tables Charts
Pivots
Tabular Reports
Summary Views

For other mandatory query string parameters such as ZOHO_OUTPUT_FORMAT, Refer to the Common parameters document for more details.

Sample URL
https://reportsapi.zoho.com/api/abc@zoho.com?ZOHO_ACTION=DATABASEMETADATA&ZOHO_METADATA=ZOHO_TABLETYPES &ZOHO_OUTPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML&authtoken=g38sl4j4856guvncrywox8251sssds&ZOHO_API_VERSION=1.0

Sample Responses

The following code snippets provides the response in JSON (ZOHO_OUTPUT_FORMAT=JSON) and XML (ZOHO_OUTPUT_FORMAT=XML)formats for the sample referred above.

XML Format

<RESPONSE URI="/api/abc@zoho.com" ACTION="ZOHO_TABLETYPES">
<ZVIEWTYPES >
<ZVIEWTYPE TYPE="TABLE"></ZVIEWTYPE>
<ZVIEWTYPE TYPE="VIEW"></ZVIEWTYPE>
<ZVIEWTYPE TYPE="REPORT"></ZVIEWTYPE>
</ZVIEWTYPES>
</RESPONSE> 

JSON Format

{"response": 
{
"uri": "\/api\/abc@zoho.com",
"action": "ZOHO_TABLETYPES",
"result":
[
"TABLE",
"VIEW",
"REPORT"
]
}
}

Back to Samples| Back to Top


Response Attributes

The following listing describes the common attributes/properties mentioned in the response.

Attribute/Property Description
IS_DEFAULT/isDefault Can be used to set defult database for third party tools that loads Zoho Reports Databases using JDBC Driver
TABLE_CAT/tableCat Zoho Reports database name (ex: SalesDB)
COLUMN_NAME/columnName Name of the column in table type views (ex: Region)
LITERAL_PREFIX Prefix character to be used when literal values found (ex: '45')
NULLABLE
whether the column takes null vale or not (ex: false)
MAXSIZE
Maximum size of the column (ex: 20)
TYPE_NAME Zoho Reports' name for the data type (ex: Positive Number)

Note:\N in XML response refer to the NULL value

More information can be found in the following Java DatabaseMetadata documentation: getTables, getTableTypes, getColumns, getTypeInfo, getCatalogs

Back to Samples| Back to Top

Google-App-Client-Library :: Version3

$
0
0

Google AppEngine Client Library

The Google AppEngine Client library is an extension to the Python client library and provides methods to integrate your applications deployed in Google AppEngine easily with Zoho Reports.

Using this API library you can make
Zoho Reports as the reporting engine for your Google AppEngine applications. You can push the required data from your Google application into Zoho Reports and create reports/analysis in Zoho Reports. You could also embed these reports back into your application, if you wish to do the same.

Pythondocs

Click here for pythondocs (Note : The main class is GoogleAppEngClient).

Download

Download the Python client library from the link below.

http://css.zohostatic.com/db/api/3_m1/ZohoReportGoogleAppDemo.zip

Reference Sample

Refer to the simple Personal Finance application built over Google AppEngine using the Google AppEngine Client library discussed above.

CloudSQL-API-Spec :: Version4.8

$
0
0

Zoho Reports CloudSQL - API Specification

SQL Querying over HTTP using Zoho Reports API

Zoho Reports has implemented the Zoho CloudSQL technology as an extension to its HTTP Web API. Using the HTTP API, users can query Zoho Reports database by providing the SQL queries.

Currently Zoho Reports 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 Reports. The data can be fetched in different response formats, which includes CSV, PDF, HTML, JSON and XML

SQL SELECT Query Request Format:

Zoho Reports uses the EXPORT HTTP API action request to execute any SQL SELECT query given. The following parameters are to be provided as part of the Export API request to execute an Select query:

Query String Parameters:

The following parameters are to be passed in the Query String

  • ZOHO_ACTION parameter should be 'EXPORT'
  • ZOHO_OUTPUT_FORMAT that defines the output format for the API request could be any of the following:
    • CSV
    • XML
    • JSON
    • HTML
    • PDF

SQL Query as POST parameter:

The exact SQL Select query has to be passed as a post parameter to the API request. The query should be passed as a value to the parameter ZOHO_SQLQUERY. The exact SQL Select query string should be URL encoded.

Sample:

The sample Select Query will fetch all the employees in the 'finance' department along with their details in CSV Format.

Entities Involved:

Database Name: EmployeeDB
Tables Involved: Employee, EmpDetails

Request URL:

https://reportsapi.zoho.com/api/abc@zoho.com/EmployeeDB?ZOHO_ACTION=EXPORT
&ZOHO_OUTPUT_FORMAT=CSV&ZOHO_ERROR_FORMAT=XML
&authtoken=g38sl4j4856guvncrywox8251sssds
&ZOHO_API_VERSION=1.0

Select Query in POST Parameter: (Note the query should be URL Encoded)

ZOHO_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 in POST Parameter:

&ZOHO_SQLQUERY=select%20%20empdet.Name%20Name%2Cempdet.DOB%20Date_Of_Birth%2C
empdet.Address%20Address%2Cemp.BasicSal%20BasicPay%2Cround(emp.BasicSal%20%2B%20emp.Allowance%2C2)%20
Salary%20from%20Employee%20emp%20inner%20join%20EmpDetails%20empdet%20
on%20emp.ID%20%3D%20empdet.ID%20where%20emp.Dept%20%3D%20'Finance'


Note


It is recommended to use Zoho Reports Login Email Address in the API URL instead of Zoho Username.


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
Kumar,"10 Dec, 1979 00:00:00",Chennai,10000,10500
....

To know more about the EXPORT API action and the parameters (like ZOHO_ERROR_FORMAT etc.,) involved in the request, refer to this link.

Next: Using Zoho Reports JDBC Driver

 

CloudSQL-Client-Libraries :: Version2.6

$
0
0

Client Libraries

To enable developers to easily use the Zoho Reports CloudSQL HTTP API, we have provided Client libraries in the below given programming languages.

More client libraries in other programming languages will be added very soon.

Java Client Library

Java client library wraps the HTTP API of Zoho Reports with the easy to use methods in Java language. This could be used if you do not want to use the Zoho Reports JDBC Driver.

Sample code snippet for using CloudSQL with Java client API:

ReportClient rc = Config.getReportClient();
rc.login(Config.LOGINNAME,Config.PASSWORD);
String uri = rc.getURI(Config.LOGINNAME,Config.DATABASENAME);
String sql = "select \"Customer Name \",Sales,Cost, \"Profit (Sales) \" from Sales where Region = 'East'";
rc.exportDataUsingSQL(uri,"CSV",new File("Test.csv"),sql,null);

For more details on Java client libraries, view this link

Samples

The sample code for Zoho Reports CloudSQL using Java Client library is available in this link

Python Client Library

Pytho Client Library wraps the HTTP API of Zoho Reports with the easy to use methods in Phython language.

Sample code snippet for using CloudSQL with Python client API:

ReportClient rc = ReportClient(Config.APIKEY)
rc.login(Config.LOGINNAME,Config.PASSWORD)
uri = rc.getDBURI(Config.LOGINNAME,Config.DATABASENAME)
sql = "select Region from StoreSales"
rc.exportDataUsingSQL(uri,"CSV",sys.stdout,sql,None)

For more details on Python client libraries, kindly view this link

Samples:

The Sample.py is bundled along with python client library which can be downloaded from the link


C# Client Library

C# Client Library wraps the HTTP API of Zoho Reports with the easy to use methods in C# .Net programming language.

Sample code snippet for using CloudSQL with C# client API:

IReportClient RepClient = new ReportClient("---authtoken---");
string DatabaseURI = RepClient.GetURI("user@sampledomain.com", "MyDatabase");
RepClient.ExportData(DatabaseURI, "XML", "Output.xml", "select * from MyTable", null);


For more details on C# client libraries, kindly view this link.



Next: Supported SQL in Zoho Reports

Viewing all 71 articles
Browse latest View live