WorldCat Search widget for Wordpress

2008 June 18

For the last 3 weeks I’ve been working on a widget for Wordpress which allows you to send a particular search to WorldCat, return the results and display them in the sidebar in Wordpress. The results are mashed-up with data from Amazon, the GoogleBook API, and LibraryThing. The goal of the project was to demonstrate how really useful the WorldCat API can be for integrating bibliographic data into blogs or other content management systems as well as show how bibliographic data can be mashed up with data from other sources.

I decided to write a Wordpress widget because my library is now running our blogs on WordpressMU and I thought it would be useful to both expand my widget building experience and also get to play around with APIs and mashups.

There were several lessons I learned building the prototype and I am greatly indebt to several folks who reviewed my code, offered suggestions, code I reused. (David Walker, Kevin Clarke and Jason Clark especially). So below are a few lessons learned.

  1. Build your widget initially so it simply collects and returns the data. I spent a lot of time trying to figure out if my problems were with how my info was being collected and returned in Wordpress or with my code that was API related
  2. Build your API and mashup code separate from your widget first. See above, I spent too much time trying to debug exactly where my code was going wrong because I went straight to building a widget
  3. XML can be very painful to work with, particularly if there are namespaces involved. I feel pretty comfortable with XML but this project had me pulling my hair out because of the interesting ways in which the XML data comes back from the WorldCat API. The XML had characteristics I’d never worked with before and that was a challenge. As a corollary to this, my experience working with XML is exclusively server side. I’ve done very little with XML via client-side scripting (Javascript). I started down that path and began to wonder whether or not it was possible or worth it when dealing with something as complex as MARCXML.
  4. I’ve developed an affinity for JSON that I didn’t think was possible. My friend Jason Clark and I teach an AJAX class and in the past I’ve been the XML advocate while he advocated JSON. It wasn’t until this project that I realized why Jason is such a big JSON fan. I discovered I really liked the way in which the GoogleBook API and the LibraryThing API allowed me to query and how the data was returned. Also, discovering that one can use JSON on both the server and client side was a plus.

I’m not going to go into detail about how the widget works either via demo or going through code. I’m saving that for a presentation I’m doing for this year’s Social Software Showcase at ALA. I’ll post my presentation on the Showcase site and here. I’ll also include some of the resources I used to write the plugin along with more of a play by play of the code.

For now I’m just excited to have a prototype working. Where exactly it goes from here, only time will tell. I’ve already thought about pulling in some info from OpenLibrary and using the xISBN service to get better results when returning book covers or GoogleBook viewability data.

6 Responses leave one →
  1. 2008 June 19

    Do you know when the widget will be ready? Our library has a WPMU installation which hosts faculty webpages and blogs and I think this would be a great plugin to offer.

  2. 2008 June 19

    Congrats. Fun, eh? Too bad I can’t be at ALA to hear your presentation. I’ll follow your posts here.

  3. 2008 June 19

    I’m hoping to post the widget code here very soon and it may be linked to off of the OCLC Developer Network site. The biggest thing to note is that WorldCat API itself is still in a pre-release stage. So the code wouldn’t be useful to anyone who isn’t part of the pre-release testing, YET.

    John,
    My presentation is actually a screencast which will be available here and on the Social Software Showcase page. Also if you’d like to join us for the APIs virtual discussion which will be taking place via TalkShoe (http://www.talkshoe.com/tc/20563) on Saturday June 28 from 3:30 – 4:30 CST, please feel free to join us.

  4. 2008 August 20

    I’ll be interested to see what use a humble book-blogger can make of it when it gets to the public-release stage. :)

    I currently use Adaptive Blue’s SmartLinks to let my readers connect to WorldCat data, as well as LT, IndieBound, Amazon, etc. I especially like the ability to give my readers the choice to use my Amazon or IndieBound affiliate links, or to get the book at their local library. So SmartLinks are pretty good, but not perfect, and there is a huge potential to develop richer systems with more open data. For myself, I use BookBurro to enhance book information in Firefox, and to search my local public and university libraries.

    Thanks for developing this!

  5. 2009 March 15

    You layout a good practice here. Build your code first then create your wordpress widget. In fact I’ve done this so many times that I ended up creating a tool to create a wordpress widget from a functional php script. The result is my new little site called widgetifyr.com. Give it a try an see it might be of help. So far it works fine for me, but if you have ideas that would make it work better for you please let me know.

    Thanks
    Glenn

Trackbacks & Pingbacks

  1. Friday Link Round Up « ellie <3 libraries

Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS

You must be logged in to post a
video comment.