API: Basics and Resources

API stands for Application Programming Interface which allows external applications to access software or Web services data, in the latter case by using HTTP request messages, for recombination (mashup) or custom presentation by the external application.

Why use APIs?

Application programming interfaces essentially allow programs and online services to talk to each other.  APIs provide a set of definitions and protocols for services to request and exchange data.  Many library vendors provide public and key-based APIs to their services in order to allow customers to pull bibliographic and other data into local systems and websites.

The Basics

For our purposes, we’ll only look at Web APIs.

Web services and applications exchange data through APIs using a request and response system.  The exchange uses HTTP and HTTPS (secure HTTP) like regular Web requests, however the data isn’t formatted for people to read but rather for other services.  The data format is usually expressed in JavaScript Object Notation (JSON) or Extensible Markup Language (XML).

API Graphic

You may see an application programming interface described as a RESTful API.  REST stands for representational state transfer.  The REST architecture can be complicated, but essentially it indicates data sent over Web protocols using HTTP commands POST, GET, PUT, and DELETE.

Some APIs are “retrieval only” allowing only the GET command to retrieve data from the Web service.  Others allow full access to get and write data to the Web service using all four of the HTTP commands.

You can also access a Web API using a URL containing a query string.  The URL will include the domain, path, and the query terms after a question mark.  The query terms can often use Boolean AND, OR, and wildcards (*). Multiple fields can be requested, separated by an ampersand (&).

The example below is an API URL which retrieves records from the Virtual International Authority File (VIAF) where the authority includes the term “Mark Twain” and returns a maximum of five records.

http://www.viaf.org/viaf/search?query=cql.any+=+”Mark Twain”&maximumRecords=5&httpAccept=application/json

Below is a good introduction to Web applications and APIs by Mark Breedlove from the Digital Public Library of America (DPLA). [40 minutes + Q&A]

Springshare LibGuides API Menu

Springshare has been very proactive in providing APIs to its LibGuides product since launch.  Users can access the API tool right from the menu.  With the LibGuides APIs, users can pull any content and data from their LibGuides site to display in their library website, blog, learning management system (LMS), and OPAC through four GET options: GET guides, GET accounts, GET subjects, and GET assets.

More recently, for its new Unified Search feature, Springshare announced that it could be used with any service that offers an open search API:

Plus, use the new Manage Search Sources tool to configure custom search sources. Any resource that offers an open search API is fair game, and anyone familiar with using these APIs will be able to set up custom search results from your library catalog, discovery sources such as EBSCO EDS, and many more! Select your source type, fill in the required fields, and voilà: your unified search is configured.

Website widgets and plugins also take advantage of APIs to pull data from Web services and also to write to them (using the POST command).  For example, most social media sites provide APIs to display feeds, provide “Follow” or “Like” buttons, and even leave comments from external applications and websites.

Probably the most common API is the familiar RSS feed seen on many blog sites.  The RSS API provides the unformatted data of blog post titles, dates, summaries, etc. which are then formatted for display by RSS readers.

This website uses a Twitter API to access and display the feed of the Library Technology Launchpad’s Twitter posts.  Website developers can access a range of Twitter APIs from the Twitter Developers Documentation site.  Here is Twitter’s description of their REST APIs:

The REST APIs provides programmatic access to read and write Twitter data. Author a new Tweet, read author profile and follower data, and more. The REST API identifies Twitter applications and users using OAuth; responses are available in JSON.

Again, APIs allow external applications to exchange data and access functions normally handled by the host Web service.


Here are some great resources to learn about library-related APIs and what they can do:

Articles and a book about APIs:

APIs Unify Library Services by Marshall Breeding

APIs Unify Library ServicesFrom the April 2014 issue of Computers in Libraries, Breeding gives a high-level overview of APIs and their increasing availability from library software vendors.  He touches on the basics, methods, scripts to access APIs, and examples of library services utilizing APIs.  Published in 2014.

Access the full-text article.

Comparing the LibraryThing, OCLC, and Open Library ISBN APIs by David Fiander

Code4Lib JournalThis article from Code4Lib Journal (Issue 21) compares the data retrieved from the API of LibraryThing, OCLC, and Open Library for related works based on ISBN.  It shows real-life API request and results data in XML and JSON. Published in 2013.

Access the full-text article.

Web Service APIs and Libraries by Jason Paul Michel

Web Service APIs and LibrariesIn this book from ALA Editions, the author demonstrates how to use APIs to integrate ten popular Web services into library websites: Twitter, Flickr, Vimeo, Google Charts, OCLC, HathiTrust, Open Library, LibraryThing, Goodreads, and Google Books.  Published in 2013.

View details and find a place to buy or borrow at Google Books.