Zoho Reports API

Tags:  

Zoho Reports API


Zoho Reports provides REST style Web APIs over HTTP. With this API, users/developers can extend their web applications to push or pull data into or from Zoho Reports for powerful analysis and reporting.

The 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 HTTP 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:


11 Comments  Show recent to old
itsjpavank@yahoo.com+(Guest), 232 - days ago  

Hello,


Don't you have API support for .Net languages ?


I am planning to use your services for a .Net based application and would like to know, if you have any API/Webservice that can be consumed from an .NET based application.


Thanks,

Pavan

shibu_alexis, 229 - days ago  

Hi Pavan,

We do support API for .net languages. Currently we do not have the client library. But we will be adding it very soon. Mean while please send us your email id to support "at" zohoreports "dot" com. we will send you the .net example to use our API.

Thanks & Regards,
Shibu Alexis
Zoho Reports.

jkurgan10 (Guest), 215 - days ago  

does the JSON format support callbacks? I tried

$.getJSON("http://reports.zoho.com/api/<ID>/<DB>?ZOHO_ACTION=EXPORT&ZOHO_OUTPUT_FORMAT=JSON&ZOHO_ERROR_FORMAT=XML&ZOHO_API_KEY=<key>ticket= <ticket>ZOHO_API_VERSION=1.0&ZOHO_SQLQUERY=select%20*%20from%20Table&callback=?

and I keep getting script errors. when i paste the URL into a browser, i'm able to see the data come back just fine.

saminathan, 214 - days ago  

Hi,

You can use the parameter ZOHO_CALLBACK_FUNCTION in the API url to callback javascript function.

Below is an example:

http://reports.zoho.com/api/<username>/<DB>?ZOHO_ACTION=EXPORT&ZOHO_OUTPUT_FORMAT=JSON&ZOHO_ERROR_FORMAT=XML&ZOHO_API_KEY=<key>ticket= <ticket>ZOHO_API_VERSION=1.0&ZOHO_SQLQUERY=select%20*%20from%20Table&ZOHO_CALLBACK_FUNCTION=<js_function_name>

Sorry that the parameter 'ZOHO_CALLBACK_FUNCTION' is yet to be documented. We will provide with the documents for the same very soon.

Thanks,
Saminathan,
Zoho Reports

Guest, 192 - days ago  

good

vasu045, 47 - days ago  

hi ,

Can you provider .net supporting API's

Thanks ,
Ramakrishna

manoharnixon, 47 - days ago  

Hi Ramakrishna,

As of now, we don't have the API client library for .Net.
But, we do have a sample VB .Net program which will be useful for you to get started with API using .Net.

Below is the sample VB .Net code to add rows into Zoho Reports online database using API.


''''''''' SAMPLE CODE - START ''''''''''''

Imports System.Web
Imports System.Net
Imports System.IO
Imports System.Text

Public Class Form1
Private Sub zoho()

' *** COMMENT: GETTING THE ZOHO TICKET ID FOR AUTHENTICATION
Dim getANewTicket As String = getZohoTicketId()
Dim address As Uri

' *** COMMENT: EXIT IF THE TICKET IS NOT VALID
If getANewTicket.Length < 1 Then
'No valid ticket
Exit Sub
End If

' *** COMMENT: CONSTRUCTING API URL TO ADD ROWS INTO ZOHO REPORTS ONLINE DATABASE
address = New Uri("http://reports.zoho.com/api/_testuser_/_database_/_table_?ZOHO_ACTION=ADDROW&ZOHO_OU
TPUT_FORMAT=XML&ZOHO_ERROR_FORMAT=XML&ZOHO_API_KEY=___abc___&ticket=" & getANewTicket & "&ZOHO_API_VERSION=1.0"
)

Try
' *** COMMENT: ADDING ROWS

' *** COMMENT: ADDING ROW #1
Dim web1 As New System.Net.WebClient()
web1.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Dim data As Byte() = System.Text.Encoding.ASCII.GetBytes("col1=val1")
Dim response1 As Byte() = web1.UploadData(address, "POST", data)
MsgBox(System.Text.Encoding.ASCII.GetString(response1))

' *** COMMENT: ADDING ROW #2
Dim web2 As New System.Net.WebClient()
web2.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
data = System.Text.Encoding.ASCII.GetBytes("col2=val2")
Dim response2 As Byte() = web2.UploadData(address, "POST", data)
MsgBox(System.Text.Encoding.ASCII.GetString(response2))

' *** COMMENT: SHOW ERROR MESSAGE IN CASE OF EXCEPTION
Catch ex As Exception
msgbox(ex.message)
End Try
End Sub

' *** COMMENT: FUNCTION TO GET ZOHO TICKET ID
Private Function getZohoTicketId() As String
'Get a ticket number with the prescribed username and password
Dim request As HttpWebRequest
Dim response As HttpWebResponse = Nothing
Dim reader As StreamReader
Dim ticketResponse As String = "" 'Hold reponse

Try
' *** COMMENT: CREATE THE WEB REQUEST TO GET TICKET ID
request = DirectCast(WebRequest.Create("https://accounts.zoho.com/login?servicename=ZohoReports&FROM_AGENT=true&LOGIN_ID=_testuser_&PASSWORD=_a_password_"), HttpWebRequest)

' *** COMMENT: GET THE RESPONSE
response = DirectCast(request.GetResponse(), HttpWebResponse)

' *** COMMENT: GET THE RESPONSE STREAM INTO READER
reader = New StreamReader(response.GetResponseStream())


Do While reader.Peek <> -1
Dim row As String = reader.ReadLine

' *** COMMENT: PARSING AND GET THE TICKET
Dim startPosition As Integer
startPosition = row.IndexOf("TICKET")
If startPosition <> -1 Then
ticketResponse = row.Substring(7)
End If
Loop
Finally
If Not response Is Nothing Then response.Close()
End Try
Return ticketResponse
End Function

' *** COMMENT: START ADDING ROWS USING API
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
zoho()
End Sub
End Class

''''''''' SAMPLE CODE - END ''''''''''''

Please get back to support "at" zohoreports "dot" com for further clarifications.


Best Regards,
Manohar Nixon S
Zoho Reports

saurabh.jadhav, 6 - days ago  

Hello,
Don't you have API avaliable for Objective C Language ? I am planning to make an Iphone Application Which uses Zoho DB . if not API, any other idea to access Zoho DB in Iphone is welcome .Hoping for reply from you. Thanks

manoharnixon, 4 - days ago  

Please find below the Objective C code which will get the ticket and uses the same in the Export API URL to fetch the data from Zoho Reports online reporting database.

/////////////////// CODE START /////////////////

// Constructing URL to get ticket
NSString *ticketurl=@"https://accounts.zoho.com/login?servicename=ZohoReports&FROM_AGENT=true&LOGIN_ID=__your_zoho_username__&PASSWORD=__your_zoho_password__";
NSError *ticketError=NULL;
NSHTTPURLResponse *ticketResponse= nil;
NSMutableURLRequest *ticketRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:ticketurl]];
// Sending request to get TICKET
NSData *ticketResponseData = [NSURLConnection sendSynchronousRequest:ticketRequest returningResponse:&ticketResponse
error:&ticketError];

// The whole response got from the URL to get ticket
NSString *ticket = [[NSString alloc] initWithData:ticketResponseData encoding:NSUTF8StringEncoding];

// Extracting TICKET ID from the response
NSString *substring = @"TICKET";
NSRange range = [ticket rangeOfString:substring];
int start_location = range.location+7;
int end_location = range.location+7+32;

NSString *ticketString = [ticket substringWithRange:NSMakeRange(start_location, 32)];

NSLog(@"Ticket id got :: %@",ticketString);

// Constructing API URL
NSString *url1=@"http://reports.zoho.com/api/__username__/__dbname__/__tablename__?ZOHO_API_VERSION=1.0&ZOHO_API_KEY=__apikey__&ticket=";
NSString *url2=@"&ZOHO_ACTION=EXPORT&ZOHO_OUTPUT_FORMAT=xml&ZOHO_ERROR_FORMAT=xml";

// Appending TICKETID to the API URL
NSString *url = [NSString stringWithFormat:@"%@%@%@", url1, ticketString, url2];
NSLog(@"API URL : %@",url);

// Initializing Response Object
NSHTTPURLResponse *response= nil;
// Constructing Request Object with URL
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]
];

// Setting HTTP Method as POST for the request object
[request setHTTPMethod:@"POST"];

NSError *error=NULL;
int errorCode;

// Invoking the URL and receiving response data
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response
error:&error];

// Logging Response Code - (200 for Http Status - OK)
NSLog(@"Response Code: %d",[response statusCode]);
// Converting Response as String
NSString *responseStrq = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
// Logging Response String
NSLog(@"Response string: %@",responseStrq);
// Logging Error if any
NSLog(@"Error: %@",error);


/////////////////// CODE END /////////////////

Best Regards,
Manohar Nixon S
Zoho Reports

Ashish (Guest), 1 - day ago  

We would like to integarte Report using API and java library, can you guide me how this will work and how this happens.

manoharnixon, 1 - day ago  

Hi Ashish,

We do have a java wrapper to use Zoho Reports APIs in java language.
You can find the guidelines and samples in the below link:

http://zohoreportsapi.wiki.zoho.com/Java-Client-Library.html

Kindly get back to support [at] zohoreports [dot] com if you find any difficulty in using Java Client Libraries.

Best Regards,
Manohar Nixon S
Zoho Reports

Post a comment



 RSS of this page

rtttr   rb