Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

APIs, Web Services, and Mashups: What they are and how they can be used

3,493 views

Published on

APIs and their use in libraries. For the 2011 Library Technology Conference at Macalester College in St. Paul, MN. March 17, 2011.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

APIs, Web Services, and Mashups: What they are and how they can be used

  1. 1. APIs, Web Services, andMashupsWhat they are and how they can be usedby Shane NackerudUniversity of Minnesota Librariessnackeru@umn.edu
  2. 2. AgendaWhat is an API?What is a WebService?What is a mashup?What are someexamples?Look at an APIA little code ...
  3. 3. What is an API?“An application programming interface (API) is aparticular set of rules and specifications that a softwareprogram can follow to access and make use of theservices and resources provided by another softwareprogram.” http://en.wikipedia.org/wiki/Application_programming_interface
  4. 4. Break it downInterface for software apps and serversApplication to Application interaction and exchange ofdataReal time communication and data exchangeAllows software programs to interact with othersoftware programs data through means other than thenormal main interface
  5. 5. Twitter API TweetdeckFacebook API
  6. 6. Web ServiceTweetDeck is a client applicationWeb services are APIs that work primarily through theweb, web servers, or a networkServer to server APIsGoogle Maps API is a good example
  7. 7. Add the code to include the Google Maps API:<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAA6JBCuUc9hZU7FVhzHksqsxSFThBmb0WgHbIO-PDXl2-6njl54hRynCyYgHJZbbA1K1ChW7zdIcbMwA"type="text/javascript"></script>
  8. 8. Add the code to include library locations data and markthem on the map:var request = GXmlHttp.create(); request.open("GET", "/libinc/libraries.xml", true); request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = GXml.parse(request.responseText); // obtain the array of markers and loop through it var markers =xmlDoc.documentElement.getElementsByTagName("marker");
  9. 9. Library Location XML Data:<markers> <marker lat="44.970971" lng="-93.243633" html="Ames Library (in Wilson Library)<br />309 19th Ave. S.<br /> Minneapolis, MN 55455<br />612-624-4857<br /><a href=http:// www.lib.umn.edu/site/fetch_hours.phtml?LibID=2> Hours</a><br />" label="Ames Library (in Wilson Library)"/> <marker lat="44.973191" lng="-93.243083" html="Andersen Library<br />222 21st Ave. S.<br /> Minneapolis, MN 55455<br />612-625-9825<br /><a href=http:// www.lib.umn.edu/site/fetch_hours.phtml?LibID=14> Hours</a><br />" label="Elmer L. Andersen Library"/>
  10. 10. Mashups A website that combines information/data from more than one source creating an integrated experience Speaking of Google Maps ...
  11. 11. http://earthquakes.tafoni.net/
  12. 12. http://trendsmap.com
  13. 13. http://whatwasthere.com/
  14. 14. Types of APIsInterface APIs Google Maps Bing Maps Yahoo Maps Open Street MapsData APIs
  15. 15. Why?Developers Get at important data/services not locally held Quicker creation of common tasks and services Learn more about their users Create whizz-bang gizmos and gadgets
  16. 16. Why?Providers Create more visibility for services offered Create more traffic for services offered Make money (some APIs aren’t free) Make customers happy and be amazed at how they use your data
  17. 17. OCLC Web Serviceshttp://www.oclc.org/developer/services
  18. 18. WorldCat Search API
  19. 19. xISSN + WorldCat Search API + Catalog API
  20. 20. xISSN + WorldCat Search API + Catalog API
  21. 21. xISSN + WorldCat Search API + Catalog API
  22. 22. QuestionPoint Knowledgebase
  23. 23. AlephX + xISBN
  24. 24. AlephX + xISBN
  25. 25. AlephX + Amazon Recommedations API + xISBN
  26. 26. AlephX + Amazon Recommedations API + xISBN
  27. 27. Query Protocol Record Formats
  28. 28. Query Protocol Record FormatsxISBN - can query the API through REST and OpenURL
  29. 29. Query Protocol Record FormatsxISBN - can query the API through REST and OpenURLData - comes back as XML, JSON, TEXT, PHP,HTML
  30. 30. Query Protocol Record FormatsxISBN - can query the API through REST and OpenURLData - comes back as XML, JSON, TEXT, PHP,HTML Say what?
  31. 31. RESTRepresentational State Transfer (REST) is a style ofsoftware architecture for distributed hypermediasystems such as the World Wide Web.For our purposes: RESTful APIs use HTTP to requestthe dataData is requested through a URL callSimilar to OpenURL
  32. 32. xISBN REST request http://xisbn.worldcat.org/ webservices/xid/isbn/ 0596002815?format=xml
  33. 33. xISBN Metadata Request http://xisbn.worldcat.org/ webservices/xid/isbn/ 0596002815?method=getMetadata&format= xml&fl=*
  34. 34. More examples at:http://xisbn.worldcat.org/xisbnadmin/doc/api.htm
  35. 35. xISBN API xisbnparse.xsl0596002815 book.php
  36. 36. xISBN API xisbnparse.xsl0596002815 book.php
  37. 37. xISBN API xisbnparse.xsl 0596002815 book.phpxHTML page
  38. 38. book.php?isbn=0596002815
  39. 39. <?php$xsl = new DomDocument;$xsl->load("xisbnparse.xsl");$xmloutput = new DomDocument;$xmloutput->load("http://xisbn.worldcat.org/webservices/xid/isbn/$isbn?method=getMetadata&format=xml&fl=*");$xsltproc->importStylesheet($xsl);echo $xsltproc->transformtoXML($xmloutput);?>
  40. 40. • U of M Libraries Mobile• AlephX, PrimoX, X-Services• PHP, XSLT
  41. 41. http://www.lib.umn.edu/libdata/rest/librestapis.html
  42. 42. AlephX + ERes RSS Feed
  43. 43. Course Specific Resource Suggestions API Subject Guide APICourse Reserves API
  44. 44. In conclusionOld and Busted New Hotness Web Server Web Server API API API Database Database
  45. 45. In conclusion With APIs the Web can truly become a networked database (of sorts) Always ask a vendor if the application has an API Start noticing APIs that are available and think ... Be a provider, too

×