Following even 'trivial' rules can have healthy results Every week or so, a librarian sends me a URL template that extends the scope of the LibraryLookup project. I started in December, as you may recall, with a page of bookmarklets, one for each of about 900 of the libraries that use the same OPAC (online public access catalog) as my local library does. Each bookmarklet is a snippet of JavaScript which, when invoked from an Amazon page (or from another page whose URL includes an ISBN), will look up the indicated book in a local library.To jumpstart the project, I rounded up a few other OPACs and made lists of bookmarklets for libraries that use them. When that became unmaintainable, I turned it into a self-serve operation. If your library’s OPAC is one of the LibraryLookup-supported systems, you can use a form to generate the bookmarklet that works with your library. Just this week, readers sent in two more URL patterns, bringing the total to nine OPACS — and I don’t know how many thousands of libraries.Also this week, a librarian wrote to ask about a variation on the theme: “I am wondering if you or someone else has developed a tool that works the other way — refers customers using the library online catalog to local bookstores, or even Amazon.com? Then if the customer makes a purchase from the online store, a percentage of sales could go back to the library. Public libraries all over the country are experiencing mind-boggling budget cuts and are desperately looking for ways to increase revenues to keep our doors open to the public. … If you can develop this ‘bookstore lookup’ tool you may one day become a patron saint of libraries.”Boy, that has a nice ring to it! But I am not likely to be canonized anytime soon. For trivial and avoidable reasons, solving this problem in a general way is not as easy as it could be or should be. If your OPAC embeds the ISBN (International Standard Book Number) in the URLs that it emits, reveals the full URL (i.e., uses HTTP GET rather than HTTP POST), and does not inject a session ID into the URL, then you’re all set. The reverse lookup, from an ISBN-enabled OPAC to Amazon or Barnes and Noble, is available from Matt Croydon, in response to a request relayed by Jenny “The Shifted Librarian” Levine.Unfortunately I cannot perform this miracle for any of the nine OPAC systems currently supported by LibraryLookup. None of them uses the embedded-URL convention predictably, if at all. Now, to be fair, librarians don’t rely on the ISBN to locate books. That number refers to an edition, not to all editions of a title. If you want to get from your OPAC to Amazon, an author/title search would be a better way. Author and title fields are clearly not things you’d ever want to stick in a URL. But Amazon does have another way to provide them. Actually, it has several ways. You can use one of its XML APIs — either the SOAP or the REST flavor. Or, even easier, you can find the author and title fields in the HTML META tag at the top of a book’s detail page. I use the latter source to automate a request to my local library for a book that isn’t in its collection. The OPAC’s request form includes required fields for author and title. As I showed in an earlier column and in more detail on my Weblog[6], it’s easy to extract the needed items from Amazon’s page by using JavaScript to query the DOM (Document Object Model). To assure my sainthood, OPACs need only emit HTML META tags containing the author, the title, and while we’re at it, the ISBN and publisher. Unfortunately, none of the nine do.If you build Web-based information systems — and who doesn’t? — it’s a great idea to wrap them in Web services APIs. The more the merrier. By offering a choice between SOAP- and REST-flavored APIs, Amazon embraces diversity. But Amazon is even more inclusive than that. It gets the simple things right. The page that represents a book has a canonical URL that you can construct automatically. It carries basic metadata in standard HTML META tags. These rules seem too trivial to mention. But they are seldom followed, even though they can spell the difference between a healthy information system that integrates with a society of peers and an isolated outcast. Moral: do the simple things. Software Development