Monday, June 13, 2011

Experience with Writing a Chrome Extension for Flipkart, Flipkart API

Even though I live in the USA, my family and I maintain contacts with India and often visit. And, when I am there, I have started using Flipkart to order books, and I find it quite a bit cheaper than competitors.

I also want to quickly look up books, see results and availability on Flipkart, and, I also use Google Chrome (and Firefox, but, I'm moving to Chrome slowly). So, I wrote my first Chrome Extension, and I will try to describe my experience.

Right off the bat, the introductory tutorial was excellent, and I was up and running within 10 minutes. By this time, I had a very basic Flipkart extension going, and was pretty excited with the progress.

Ten minutes later, I ran into a small problem. I was trying to use the DOM to turn a button's value from "Search" to "Loading...", and I had written the code, but, it wasn't working. So, I tried to figure out how to debug it. For 20 or so minutes and bashed my head against the problem with console.log() statements scattered throughout the code. Then, I read the debugging tutorial which was also excellently written by the very clever people over at Google.

I have been a Firebug devotee, but, once I started moving over slowly to Chromium/Chrome, I am liking the developer tools more and more. And, for writing the chrome extension, I could use the developer tools. The debugger is very good, and the syntax checker is extremely useful. I had a ton of trouble getting AJAX to work properly without a ton of lag, and the developer tools have excellent AJAX debugging, and I had absolutely no trouble.

Now, for the bad parts. The biggest annoyance in developing the extension wasn't really chrome or any of that, it was just that I would have saved myself a lot of page scraping if Flipkart provided a simple API that let me access its product database, I think I might start a project, so I can write an external one. The next annoyance (completely unrelated to Chrome), was weak typing. Javascript just totally ruined my life on this project, because I was doing a few things very stupidly,
a) Not using jQuery
b) Using the "+" operator without type checking
c) Not properly looking at Flipkart's DOM before trying to implement code that uses it

This isn't Javascript's fault (except b, which the world hates it for), more like my fault.

All in all, writing a chrome extension was a very good experience, and I would happily write another, I just need any ideas you have :)


  1. Sounds interesting. What exactly did the extension do wrt flipkart since flipkart doesnt have an API?

  2. It scraped through flipkart, added to stuff to wishlist, and did an AJAX search, install it!

  3. hi,
    i have seen a api called flipcurl in to access the flipkart database, but it is out of date now as flipkart has changed a lot nowadays. do you think you can make changes to it to work with present flipkart? you need to have some PHP knowledge

    1. I definitely could. Would you like to work on it together?

    2. yes love to... i am learning PHP i am not an expert, but with some guidance i can pick it can mail me at