2. What is an API?
• An “Application Programming Interface.”
• Wikipedia: An application programming
interface (API) is a source code based
specification intended to be used as an
interface by software components to
communicate with each other. An API may
include specifications for routines, data
structures, object classes, and variables.
3. Huh??
• You use it to pass information between two
programs, often on the Web
• Web-based API = “Web services”
4. Two Kinds of APIs
• SOAP
– We don’t care about this one
• REST
– This is the one you want
• What’s a RESTful API
– I don’t really know, but it looks like an OPAC
canned search
6. RESTful API Requests
• They look similar to canned OPAC searches
• Base:
– http://www.worldcat.org/
• Path
– webservices/catalog/search/opensearch?
• Query
– q=texas%20rock%20music&
– wskey=p21UMn6mINQV2uXvborGIWDxYMG7YxwnkE
SLcxFQrpcwPog0cUDylripgHgzJkx93o2fPPHT1OldL8LE
7. All Together Now
• http://www.worldcat.org/webservices/catalog
/search/opensearch?q=texas%20rock&wskey=
p21UMn6mINQV2uXvborGIWDxYMG7YxwnkE
SLcxFQrpcwPog0cUDylripgHgzJkx93o2fPPHT1
OldL8LE
8. Another Example
• Base
– http://www.worldcat.org/
• Path
– webservices/catalog/content/53138893?
– Note: an OCLC number is part of the path
• Queries (Developer Key in this case)
– wskey=6omTbWBPu4oEuQ4gnXEx2YwjwMfQMDD
zOoVubVlEackZrX9r0yKs7u7hmUiABnXH85bUunlQ
Euyoz9iD
9. Single Record in MARCxml
• http://www.worldcat.org/webservices/catalog
/content/53138893?wskey=6omTbWBPu4oEu
Q4gnXEx2YwjwMfQMDDzOoVubVlEackZrX9r0
yKs7u7hmUiABnXH85bUunlQEuyoz9iD
10. Other Worldcat APIs
• http://oclc.org/developer/webservices
• Basic API (Open to anyone)
• Only allows un-fielded keyword search
• Results in RSS, Atom, or formatted citations only
• Search API (For institutions contributing to
Worldcat)
• More options for searching and output than Basic API
• xISBN (Retrieves related ISBNs)
• Identities (names, corporate names, subjects)
11. Using APIs with Yahoo Pipes
• An example in Yahoo Pipes
– http://pipes.yahoo.com/mspal/worldcatopensearchsi
mple
– This pipe simply allows you to search Worldcat using
an API request rather than the Worldcat interface.
This is how you would create a widget for Libguides
for example
– To see under the hood, create a Yahoo account and
click “view source”
– You can also clone the pipe and experiment with
making changes
12. Mashing It UP
• An example using both the Worldcat Basic API and the
Last.FM API
– http://pipes.yahoo.com/mspal/lastfmandworldcat
– (You might need to click “Run pipe” before seeing results)
– This one uses the Last.FM to retrieve the last few tracks a
user has heard
– Album and artist info are retrieved and used to build a
query to search the Worldcat API
– Worldcat search results than are presented with links into
Worldcat
– You can view results for a different user simply by entering
a user in the search box
13. Useful Books
• Engard, Nicole. Library Mashups: Exploring New
Ways to Deliver Library Data. Medford N.J.:
Information Today Inc., 2009.
• Matthews, Martin. Dynamic Web Programming: a
Beginner’s Guide. New York: McGraw-Hill, 2010.
• Makice, Kevin. Twitter API: Up and Running.
Sebastopol Calif.: O’Reilly, 2009.
• Pruett, Mark. “Yahoo! Pipes”. Sebastopol, Calif.:
O’Reilly, 2007.
14. Links
• OCLC Web Services
– http://oclc.org/developer/webservices
• Last.FM API
– http://www.last.fm/api/intro
• Yahoo Pipes
– http://pipes.yahoo.com
• Handout from a workshop on Yahoo Pipes, RSS feeds, and Worldcat
– http://www.lib.umd.edu/JUNK/shenry/wcl-handout.pdf
• Running Bibliography on Music, APIs, and Libraries
– http://www.mendeley.com/groups/1910831/music-apis-and-
mashups-for-libraries/
• Me
– shenry@umd.edu