R.O.EYE Guest Blog Post - Taking the plunge into the API

Many publishers can be put off by the thought of the API, but when promoting a site such as eBay, with its dynamic catalogue of millions of products and constantly changing prices, it really is too good a tool to be overlooked. So what is it?

Good question – API stands for Application Programming Interface, which is a facility to allow a program to request a service from a library – or simply put, it allows your website, widget or application to ask questions to the eBay database and get a response. Just think of the things your website could do if it had direct access to eBay’s database! And the best part is that if you’re confident enough to build your own website the API might not be as hard to integrate as you may have first thought…

Three simple steps:

The first step is to get signed up to the eBay Developers Program. You will be assigned an AppID, which is your unique token allowing you access to the API.  You will also get a Sandbox and Production Key.  If you are building a listing tool, you will want to test it in the Sandbox with dummy listings, otherwise you should use the Production Key directly – this gives you access to live eBay data that you see on the site.

The second step is to construct your API call. The most simple of these is FindItems, and can take the form of a simple URL. There is a great tutorial on the developer site which shows a simple step by step guide on how to construct the call.

The third step is to format the data you receive into something readable on your site. You can request the data in JSON, SOAP, XML or text Name Value.

If you are a product feed publisher, parsing the data should be second nature. If not, the same tutorial provides a simple JavaScript example.  You can use JavaScript, PHP or any programming language you’re familiar with to dynamically render the live listings on your page. Perhaps you can use the eBay API to import results directly into your SQL database - but remember if you choose this option, filter results to items which aren’t ending in very near future, to prevent you displaying expired listings.

What next?

The real power of the API however comes with what you do with the data. Remember, you have at your disposal a live link direct to the eBay database, so the limit is only that of your imagination.  A good example is http://www.watchcount.com which picked up an award in the 2009 eBay Star Developer Awards. It utilises the API to look at what the most watched items are on eBay. Check out the website for more great innovative uses of the API. Another example uses API results to calculate an average selling price for an item, and then highlights the displayed items which are cheaper.

And if you need a nudge in the right direction, here is our code for the above console comparison page, and also some more example code to create a very simple search tool.

James Skelland, Technical Solutions Manager at R.O.EYE

James will be writing another post on more advanced API tips later in the year.