using the dpla api as community reps webinar august 19, 2014 a platform to build upon danielle...
Post on 25-Dec-2015
216 Views
Preview:
TRANSCRIPT
Using the DPLA API as
Community Reps WebinarAugust 19, 2014
A PLATFORM TO BUILD UPON
Danielle Cunniff Plumerdanielle@dcplumer.com@dcplumer
THE API: ACCESS TOMILLIONS OF ITEMS,FOR ANY PURPOSE
What is an API?
Application Programming Interface
. . . a set of functions or routines that accomplish a specific task
. . . a specification of how objects work in a given object-oriented language
. . . an implementation of a protocol
APIs you may have used
• Have you ever:• Accessed one library catalog from within another
library catalog?• Z39.50
• Embedded a Google Books preview in a library catalog?• Google Book Search Embedded Viewer API
• Geocoded addresses and place names for display on a map?• GeoNames Search Webservice• Google Maps API Geocoding Service
DPLA Search Widget• https://github.com/lfarrell/DPLA-Search-Widget• https://github.com/lfarrell/Wordpress-DPLA-Search-Wi
dget-Plugin
• Generates a search query that is sent to the DPLA Portal (http://dp.la)
Behind the magic curtain
1. User puts search term into HTML form
2. Form prepends DPLA search URL (http://dp.la/search?q=)
3. Clicking “search” sends query to DPLA API using HTTP GET
4. DPLA Portal opens in same page
For discussion for how to customize this widget, see http://www.dcplumer.com/2014/04/hacking-dpla-at-tcdl/
DPLA API Search Widget• https://github.com/dcplumer/dpla-search-tutorial/
• Generates a search query that returns results on your own web page using the DPLA API.
Working example at http://www.dcplumer.com/dpla-search/dpla-api-search.php
http://api.dp.la/v2/items?q=panda&api_key=$YOUR_KEY
Behind the magic curtain
1. User puts search term into PHP form
2. PHP prepends API search URL and appends API Key
3. Clicking “search” sends query to DPLA API using curl4. Get results back from DPLA
5. Interpret results using a PHP function called json_decode
6. Display results
For step-by-step discussion, see http://www.dcplumer.com/resources/handouts/dpla-api-tutorial-2/
DPLA API Results
Note: Shown in Mozilla Firefox with JSONView Extension
api.dp.la/v2/items?q=panda&api_key=$YOUR_KEY(API query with API Key appended)
DPLA API Key
See http://dp.la/info/developers/codex/policies/#get-a-key • Mac or Linux: Terminal (in Applications/Utilities)curl -v -XPOST http://api.dp.la/v2/api_key/YOUR_EMAIL@example.com
• Windows: CuRL or something similar • Browser plugins:
• Poster (Firefox)• Postman (Chrome)
DPLA API Key – Terminal Method
DPLA API Key – Postman Method
• Install Postman from Chrome Web Store (free)• Enter Request URL: http://api.dp.la/v2/api_key/YOUR_EMAIL
• Select method POST• Click Send
DPLA API Key – Postman Method
DPLA API Key – Postman Method
DPLA API Requests• Allows Boolean operators AND and OR plus wildcards (*)• Allows searching within fields (similar to refinements in
DPLA Portal)
• By Format• Contributor• Partner• By Date• By Language• By Location• By Subject
DPLA API Requesthttp://api.dp.la/v2/items?sourceResource.title=panda&sourceResource.type=image&api_key=$YOUR_KEY
Searching within Fields• Any field in
sourceResource:• title• collection• stateLocatedIn• type• description• Subject
• Provider (Partner)• dataProvider
(Contributing Institution)
http://dp.la/info/developers/codex/requests/
Discovering Facet Optionshttp://api.dp.la/v2/items?sourceResource.title=panda&facets=sourceResource.type,provider.name&api_key=$YOUR_KEY
Facet: Type
Facet: Provider Name
Designing a DPLA Advanced Search• See http://europeana.eu/portal/widget/editor.html for ideas:
Getting Code
Getting Code
Getting Code
Getting Code
API Key
API Query
App Wishlist• http://dp.la/info/developers/ideas-and-projects/
App Wishlist• http://dp.la/info/developers/ideas-and-projects/current-ideas/
visit dp.laContactinfo@dp.la
@dpla
top related