API Hackery:      Customizing Your Library’s         Services Using APIs   Nicholas Schiller    Presentation site: bit.ly/...
Desired Outcomes:You will be able to explain how APIs work.You’ll leave with ideas on how APIs can helpyour patrons.You’ll...
This Talk is Not:A step-by-step tutorial or walkthrough.(There will be gaps.)A coding lesson. (My role there is student or...
APIs are:Application Programming Interfaces Specifications and standards   Keys to the silo     How to ask a service for   ...
APIs are about sharingdata.Librarians are aboutsharing information.APIs and Librarians shouldbe friends.
APIs are a key part of   library systems’movement from closed “black-box” tools to truly open systems.
Examples:Google Maps API  With an authentication key and latitude &  longitude coordinates, you can put a map  on your pag...
We’ll want a guide to lead us through this.  For technology optimists:   he will be our Beatrice.              Our Beatrice
For technology pessimists     he will be our Virgil.
Dr. Walter BishopOur guide for building wonderful        things with APIs
I amforming ahypothesis.               Would                  you               like to              hear it?
The relative                             difficulty* of                 1/6                             making library     ...
The caveats: *Two      Relative Difficulty Levels*    1. I made these ratios up. They don’t                1/6    reflect my...
Write codeArticulate your                            using an API to problem and  identify a                   +         g...
Articulate   Information            API + scripting                          language (PHP,   Need, form      +     JavaSc...
“Let me introduce you to test                subject #6.”
Practical example of an   API solving a real    library problem. Our WorldCat Local discovery layer presents obstacles to ...
“We need her tohelp us understand this skill.”
To Successfully find an  eBook in our collection:Type the following into our WorldCat discovery tool:     kw:NASA +mt:ebk -...
Dont you understand this is Greek   to me? Except that I speak Greek. This is Aramaic to me. Notthe western dialect, I do ...
What we need is:something to automatically do this for eBooksearches.to get the user’s search query, add ourBoolean logic ...
While we’re at itLet’s format our tool for tablets and mobiledevices.Let’s connect the user directly to the fulltext right...
Core Librarianskills: information         API + scripting                            language (PHP,need articulation,    +...
WorldCat Search APIRequest a key. (Keys denote permission toaccess the service.)Submit your requests formatted in eitherop...
WorldCat Search APIOpensearch: from A9 www.opensearch.org  basic structure, kw indexes only  returns RSS or AtomSRU: www.l...
For Our Examplewe can use both  The WorldCat Search API can return  formatted citations using opensearch.  Opensearch only...
http://www.worldcat.org/webservices/ catalog/search/worldcat/opensearch?  q=srw.kw+any+%22biofuel%22+and+srw.li+any+%22ws2...
A friend from Washington Stateinvented these glasses in order to   be able to see a URL’s aura.
http://www.worldcat.org/    webservices/catalog/search/ worldcat/opensearch?q=srw.kw+any  +”biofuel”+and+srw.li+any+”ws2”+...
Let’s Celebrate, Because the Hard Part is Done.
API + scriptinglanguage (PHP) +    HTML 5
Excellent.Let’s make some <?PHP ?>
Do You Remember?Slide 17: “What we need is to get the user’ssearch query, add our Boolean logic phraseto the query, get th...
Audience Choice:Look at the codeLook at the web app (beta)
Special Thanks to:Jason Clark with Montana State UniversityLibrariesBruce Washburn with OCLC ResearchThey shared their cod...
HTML 5,  CSS 3 &jQuery Mobile
Either a green unicorn just raced                   across the lab,or I accidentally used jQuery           Mobile.
jQuery Mobile automates:    The buttons, pickers, & search inputs    The theme and color scheme    The behavior in diverse...
Image CreditsJohn Noble / Walter Bishop / Walternate images arefrom the Fox TV series Fringe and are used under fairuse as...
Demo the Web App (beta)      bit.ly/WvqAR4Code Repository on GitHub:https://github.com/nnschiller/           easy_api
Further ReadingOCLC Worldcat Search API    http://www.oclc.org/developer/services/worldcat-    search-api    http://www.oc...
Further ReadingOpensearch      http://www.opensearch.org/Home      http://oclc.org/developer/documentation/worldcat-      ...
Further ReadingTutorials       http://www.codecademy.com/courses/javascript-       beginner-en-EID4t       http://www.tiza...
API Hackery:      Customizing Your Library’s         Services Using APIs   Nicholas Schiller    Presentation site: bit.ly/...
Walter api
Walter api
Walter api
Walter api
Upcoming SlideShare
Loading in …5
×

Walter api

583 views

Published on

  • Be the first to comment

  • Be the first to like this

Walter api

  1. 1. API Hackery: Customizing Your Library’s Services Using APIs Nicholas Schiller Presentation site: bit.ly/XqyzfMWSU Vancouver Library Test the app: bit.ly/WvqAR4Online Northwest 2013 C o d e o n G it H u b : htt p s: // February 8, 2013 github.com/nnschiller/easy_api Corvallis, OR
  2. 2. Desired Outcomes:You will be able to explain how APIs work.You’ll leave with ideas on how APIs can helpyour patrons.You’ll leave energized to make things.
  3. 3. This Talk is Not:A step-by-step tutorial or walkthrough.(There will be gaps.)A coding lesson. (My role there is student orpeer not instructor.)A technical treatment of the subject.
  4. 4. APIs are:Application Programming Interfaces Specifications and standards Keys to the silo How to ask a service for what you want.
  5. 5. APIs are about sharingdata.Librarians are aboutsharing information.APIs and Librarians shouldbe friends.
  6. 6. APIs are a key part of library systems’movement from closed “black-box” tools to truly open systems.
  7. 7. Examples:Google Maps API With an authentication key and latitude & longitude coordinates, you can put a map on your page.WorldCat Search APITwitter APIs Instructions for capturing tweets and hashtags.
  8. 8. We’ll want a guide to lead us through this. For technology optimists: he will be our Beatrice. Our Beatrice
  9. 9. For technology pessimists he will be our Virgil.
  10. 10. Dr. Walter BishopOur guide for building wonderful things with APIs
  11. 11. I amforming ahypothesis. Would you like to hear it?
  12. 12. The relative difficulty* of 1/6 making library tools with APIs. 2/3 1/6the problem & solution the code the design
  13. 13. The caveats: *Two Relative Difficulty Levels* 1. I made these ratios up. They don’t 1/6 reflect my time invested. 2/3 1/6 2. What we don’t know how to do (yet) seems much harder, but we can learn & we can find help. “Pseudo-code is your friend” or follow Anne Lamott’s advice on first drafts. the problem & solution the code the design
  14. 14. Write codeArticulate your using an API to problem and identify a + generate the desired solution. solution. Wrap the solution code in + a user friendly format.
  15. 15. Articulate Information API + scripting language (PHP, Need, form + JavaScript, Ruby,Boolean Queries, ID Appropriate Python) + HTML 5 Data Sources HTML 5, CSS 3 & + jQuery Mobile
  16. 16. “Let me introduce you to test subject #6.”
  17. 17. Practical example of an API solving a real library problem. Our WorldCat Local discovery layer presents obstacles to students who are looking for ebooks. The ebooks facet doesn’t use the same definition of ebook that our students assume.
  18. 18. “We need her tohelp us understand this skill.”
  19. 19. To Successfully find an eBook in our collection:Type the following into our WorldCat discovery tool: kw:NASA +mt:ebk -mt:gnp -mt:cpb -mt:deg Also consider excluding material types upw, upc, cdc, dct
  20. 20. Dont you understand this is Greek to me? Except that I speak Greek. This is Aramaic to me. Notthe western dialect, I do speak it.
  21. 21. What we need is:something to automatically do this for eBooksearches.to get the user’s search query, add ourBoolean logic phrase to the query, get theresults and present them to the user.the WorldCat Search API.
  22. 22. While we’re at itLet’s format our tool for tablets and mobiledevices.Let’s connect the user directly to the fulltext right on their tablets and/or mobiledevices or whatever screen they prefer.(I’m working on the assumption that eBooksand tablets go together.)
  23. 23. Core Librarianskills: information API + scripting language (PHP,need articulation, + JavaScript, Ruby) + Boolean queries, data source HTML 5 expertise HTML 5, CSS 3 & + jQuery Mobile
  24. 24. WorldCat Search APIRequest a key. (Keys denote permission toaccess the service.)Submit your requests formatted in eitheropensearch or SRU standards.Specify how you want the data returned.
  25. 25. WorldCat Search APIOpensearch: from A9 www.opensearch.org basic structure, kw indexes only returns RSS or AtomSRU: www.loc.gov/standards/sru/ enables complex queries of multiple indexes returns XML or MARC
  26. 26. For Our Examplewe can use both The WorldCat Search API can return formatted citations using opensearch. Opensearch only searches keyword indexes but our search requires the material type index. If we want to search the mt: index and get formatted citations, we’ll need to use opensearch with SRU formatting. The API allows this.
  27. 27. http://www.worldcat.org/webservices/ catalog/search/worldcat/opensearch? q=srw.kw+any+%22biofuel%22+and+srw.li+any+%22ws2%22+and+srw.mt +any+%22ebk%22+not+srw.mt+any+%22gpb%22+not+srw.mt+any+%22cnp %22+not+srw.mt+any+%22deg %22&format=rss&cformat=chicago &wskey=[insert your API key here]
  28. 28. A friend from Washington Stateinvented these glasses in order to be able to see a URL’s aura.
  29. 29. http://www.worldcat.org/ webservices/catalog/search/ worldcat/opensearch?q=srw.kw+any +”biofuel”+and+srw.li+any+”ws2”+and+srw.mt+any+”ebk”+not+srw.mt +any+”gpb”+not+srw.mt+any +”cnp”+not+srw.mt+any+”deg” &format=rss&cformat=chicago &wskey=[insert your API key here]
  30. 30. Let’s Celebrate, Because the Hard Part is Done.
  31. 31. API + scriptinglanguage (PHP) + HTML 5
  32. 32. Excellent.Let’s make some <?PHP ?>
  33. 33. Do You Remember?Slide 17: “What we need is to get the user’ssearch query, add our Boolean logic phraseto the query, get the results and presentthem to the user.”Our code will do EXACTLY these threethings.As a n00b coder, I was only able to succeedby keeping a razor-sharp focus on exactlythese goals.
  34. 34. Audience Choice:Look at the codeLook at the web app (beta)
  35. 35. Special Thanks to:Jason Clark with Montana State UniversityLibrariesBruce Washburn with OCLC ResearchThey shared their code under FreeBSD andGNU open licenses, allowing me to borrowfreely.
  36. 36. HTML 5, CSS 3 &jQuery Mobile
  37. 37. Either a green unicorn just raced across the lab,or I accidentally used jQuery Mobile.
  38. 38. jQuery Mobile automates: The buttons, pickers, & search inputs The theme and color scheme The behavior in diverse screens and browsers
  39. 39. Image CreditsJohn Noble / Walter Bishop / Walternate images arefrom the Fox TV series Fringe and are used under fairuse as set forth in the Code of Best Practices for FairUse in Online Video. See especially #6 SIX: Quoting inOrder to Recombine Elements to Make a New WorkThat Depends for its Meaning on (Often Unlikely)Relationships Between the Elements.The images from Dore’s engravings of Dante’s DivineComedy are in the public domain.
  40. 40. Demo the Web App (beta) bit.ly/WvqAR4Code Repository on GitHub:https://github.com/nnschiller/ easy_api
  41. 41. Further ReadingOCLC Worldcat Search API http://www.oclc.org/developer/services/worldcat- search-api http://www.oclc.org/worldcatapi/default.htm http://www.oclc.org/us/en/support/documentation/ firstsearch/z3950/z3950_databases/specs/ materialtypes.htm http://www.oclc.org/developer/news/worldcat-search- api-tips-and-tricks
  42. 42. Further ReadingOpensearch http://www.opensearch.org/Home http://oclc.org/developer/documentation/worldcat- search-api/opensearch-responsesSRU http://www.loc.gov/standards/sru/ http://www.worldcat.org/webservices/catalog/ search/sru?wskey=[YOUR WCS API KEY IS REQUIRED]
  43. 43. Further ReadingTutorials http://www.codecademy.com/courses/javascript- beginner-en-EID4t http://www.tizag.com/phpT/ http://www.codecademy.comCode http://www.worldcat.org/devnet/code/devnetDemos/ trunk/webservices_php_libraries/ wcapi_opensearch.php http://www.lib.montana.edu/~jason/files/worldcat- basic/code.txt
  44. 44. API Hackery: Customizing Your Library’s Services Using APIs Nicholas Schiller Presentation site: bit.ly/XqyzfMWSU Vancouver Library Test the app: bit.ly/WvqAR4Online Northwest 2013 C o d e o n G it H u b : htt p s: // February 8, 2013 github.com/nnschiller/easy_api Corvallis, OR

×