Archive

Archive for April 25, 2009

Google Data APIs and Analytics

Updated May 7th 2009 – see here.
I was real happy to see the annoucement of the Google Analytics API and anxious to get started.
As-is the API is available through the JavaScript and Java programming languages, as well as open to protocol interactions using raw XML and HTTP. This is all great, but i’m a .NET developer and would of course have liked to see the analytics API implemented in the Google Data APIs .NET Client Library, as was done with the Java (1.31.1) version of the library.

Since the full source for the Java version is available I thought I would have a look and maybe give a shot at porting it to C#. So I gave myself and the code 4 hours to see how far I could get implementing the analytics api in the .NET client library. Two hours in it was clear that my Java skillsĀ  aren’t as good as they used to be… I don’t think I have actually touched Java since 2003. But I continued anyway, as the code spawned.
I created the Service class, which uses AccountFeed and DataFeed that uses AccountQuery and DataQuery respectively. And then there is the Entry class(es)… this is there I started to see double – wish I had a better recollection of Java even though it is very similar to C#. I compared alot of the Java and C# implementations of the Feed and Query classes of google calendar and contact, but two hours in my head started spinning…

Before I have a chance to have someone a bit more skilled in Java then me, I will proably not do to much more work on porting the analytics api. But if anyone should be interested in helping out, please give me a buzz. If you wanna review the current code and give me an indication of the direction, please feel free to do so.

Also, if you want to contribute please drop a comment.
I will be happy to do some more coding when I get back on track with how the structure should be in the C# version.

Here is a zip-file of the project (VS2005) – the source code that come with the Google .NET client library.

I will write another post within the next couple of dayes, which goes a bit more into details about the code. AND hopefully have time to make some unit tests…

Updated May 7th 2009: Please download the new zip with the complete project – VS2005 client library including analytics.
The previous file (and project) was very much a work in progress. I have continued the work by studying the other implementations and the existing Java implementation to build a .NET version of the analytics api, which is now complete.
It currently lacks unit tests, so if anyone wants to join in please feel free to do so. I probably won’t have to to do unit testing for the next 3 weeks, but I do plan to write a follow-up post on how to use the api using .NET. Also, in the Java implementation the dxp:aggregates node is implementated so you can access it as an object – this is currently not implemented. Please let me know if you need it.

Categories: Google API Tags: , ,