Sunday, January 21, 2007

Zoho Widget v0.1 and problems with Zoho API

Zoho added an API for their Zoho Sheet and their Zoho Writer not too long back, you can read quite a bit more about it over on their blog.

The API is quite a cool, it provides a pretty easy way to connect to either of the two applications (hoping Show is coming soon) the docs are fairly straight forward--for those of you who have already worked with XML-RPC style commands - but a "dumbed down version" ain't there you'll be able to find one on the new Zoho Wiki under my pages as soon as I get it all updated.

What I did was come up with a simple little Widget idea, a simple inbox where I can see all my docs and sheets quickly and easily and do something with them before logging into the site/service. So far I've not seen a single thing released to the public (other than the stuff from Desktopize) so I wonder if I am the first?

zoho_widget_1

The complete code and Widget will be available via the Wiki mentioned above as soon as I get a few answers to some issues I'm having with the API (probably just me but just in case)...

The widget right now is sporting the ability to grab all your documents and sheets (soon I hope) in alphabetical order as well as open them, delete them, download them and a quick view of the "doc" content. The display of each includes a bit more data than the screen shot as well (older screen shot I've been busy).

So what type of problems am I having with the API? Well for one I seem to get an authentification error with Zoho Writer unless I log into the website via the browser just once (perhaps a reboot will solve that and it's just me testing too much?)

The other problem I'm having is actually a big one and I think it's just a lack of documentation or it's just "bad" documentation? Sorry guys! First off why is there such a big difference between the API for Sheet and Writer? I've had to build several "if" statements into my Widget to handle whether it's one or the other, the idea is a single inbox with all the data -- I don't mind having to login twice to get a Ticket for Writer then a Ticket for Sheet but why does the documentation have two complete different formats for the basic header request?

Here's the basic call to get all the documents in your account: 

<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<methodCall xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://writer.zoho.com/schema/document.xsd">
<methodName>writer.getDocuments</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>fromindex</name>
<value><int>2</int></value>
</member>
<member>
<name>noofdocstoshow</name>
<value><long>6</long></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
Now for getting all the sheets in your account (these are from the docs):
<methodCall>
<methodName>zohosheet.userView.getWorkbooks</methodName>
<params>
<param>
<name>startIndex</name>
<value>6</value>
</param>
<param>
<name>noOfBooks</name>
<value>5</value>
</param>
<param>
<name>sortBy</name>
<value>lastModifiedTime</value>
</param>
<param>
<name>isAscending</name>
<value>true</value>
</param>
</params>
</methodCall>
 





Even the naming conventions are different? writer.getDocuments and zohoSheet.userView.getWorkbooks OK I'm not so picky but I was hoping for a bit of standardization.


So my big problem and what is holding up the release of v0.1 is when calling the Zoho Sheet.

url.location = "http://sheet.zoho.com/api/xml?apikey=" + preferences.APIKey.value + "&ticket=" + ticketID_Sheet;
url.postData = "<methodCall><methodName>zohosheet.userView.getWorkbooks</methodName><params></params></methodCall>";



So it's the same way I call the Writer the difference is that the writer call is well defined in the docs and the Sheet one does not include "all" the info at least that is what I am thinking - waiting on a response from the support folks to be 100% sure - like I said it's probably just me doing something silly and thinking too much...


 


Technorati tags: , , ,

2 comments:

Jill said...

Awesome widget. I hope you add it to yahoo widgets gallery. I search for it from time to time.

Craig said...

Soon as I get a chance to finish up with the new features in the API I will submit it there.