Explaining Web Service APIs with Library Examples

By Jason Paul Michel |

Editor's Note: Jason Paul Michel is teaching the ALA Editions ecourse Introduction to Web Service APIs Using PHP and HTML , which starts October 15. This post is adapted from his book on the topic, a PDF version of which is included with the ecourse.

Libraries have lost the battle. The web is now, and has been for a while, where people go to find information.

But that is a vague statement. Imagine the web as a huge, vast cityscape. Most of this city consists of sparsely populated back alleys and warrens, while standing at the center are a few heavily populated monoliths: Google, Wikipedia, Facebook, Twitter, IMDb, Flickr, and a few others. These are the places people go to find information.

Our library websites, including our unique digital collections, are found in one of those back alleys, twenty blocks from Google (twenty pages deep). Unfindable. Dusty. Lonely. All is not lost, however. There is a way to put library websites front and center, and that is through the use of APIs. APIs allow programmers and developers to both deliver content to and receive content from the web’s larger, more highly used services. At the same time, APIs give developers the tools and data to create valuable, user-friendly services of their own.

What is an API?

An API, or application programming interface, is a set of methods to access data in otherwise closed systems. APIs give programmers and developers the tools necessary to build software and services with data and services from external sources. Extending a metaphor used by David Orenstein, let’s imagine that you are building a deck in your backyard and you realize that you don’t have a hammer. You have three neighbors who you know have a hammer. One neighbor never allows anyone to borrow anything or use any of his stuff without paying up. This neighbor represents a closed or proprietary system. Another neighbor leaves his garage open and allows you to take anything you need without any rules or guidelines. This is your bearded open-source neighbor. The third neighbor represents an API. You can utilize the services of her hammer as long as you ask her in the proper way. Furthermore, she doesn’t actually give it to you; she just allows you to use it.

Web service APIs, designed for specific web applications, are one of the hallmarks of the current web ecosystem: an ecosystem based on openness and sharing. Post to Facebook, tweet this, Tumblr that, and so on. The web services we use are no longer closed, autonomous systems. They work together, data flowing freely between them.

Using Web Service APIs in Libraries

So, what type of library services can be developed through the use of APIs? Here are some potential applications.

The Twitter API can be utilized to programmatically mine tweets coming from users in your area. You can query this data to see if people are tweeting about your institution, or tweeting about reading, books, doing research, and the like. This insight can give you an opportunity for proactive reference or outreach services. You could use use the Twitter API as an in-house outage reporting tool.

Imagine you have a large collection of interesting digital images that are hosted on your library’s website. The audience for these images is limited if they remain only on your site. Using the Flickr API, you can upload large numbers of digital images and accompanying data in a short amount of time. Sharing these images on Flickr will expose your content to a much wider audience.

You can also use the Flickr API to pull images onto your site. For example, you might use it to serve up Flickr content alongside library content related to a current event. Imagine a web page with a dynamic list of library books and articles related to a hotly contested election with a slideshow near the top of the page of Flickr images from the campaign trail.

Vimeo is a prime example of a web service API that enables posting your own content to your own site without building up unnecessary infrastructure. Let’s say you have instructional videos for your library. Rather than worrying about how to upload a video to your own server, it may be easier to upload your video content to a site like Vimeo and display those videos on your site using their API.

Google Charts
Using the Google Charts API, you can add data visualization aspects to your site. The API could be utilized to display in a graphical way how many computers are available in your computer lab, how many laptops or other pieces of circulating equipment are available for checkout, circulation stats, and more.

Bibliographic Service APIs
Utilizing the APIs of web services such as OCLC, LibraryThing, Open Library, Google Books, and others allows you to develop services that can enrich your library catalog: book covers, book reviews, recommendations, full-text e-books, and more.