Using the DPLA API as Community Reps Webinar August 19, 2014 A PLATFORM TO BUILD UPON Danielle Cunniff
THE API: ACCESS TO MILLIONS 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 Apps
DPLA Search Widget Widget-Plugin Widget-Plugin Generates a search query that is sent to the DPLA Portal (
Behind the magic curtain 1. User puts search term into HTML form 2. Form prepends DPLA search URL ( 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
DPLA API Search Widget Generates a search query that returns results on your own web page using the DPLA API.
Working example at dpla-search/dpla-api-search.php dpla-search/dpla-api-search.php a&api_key= a&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 curl 4. Get results back from DPLA 5. Interpret results using a PHP function called json_decode 6. Display results For step-by-step discussion, see
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) api.dp.la/v2/items?q=panda&api_key=$YOUR _KEY (API query with API Key appended)
DPLA API Key See Mac or Linux: Terminal (in Applications/Utilities) curl -v -XPOST ample.com Windows: CuRL or something similarCuRL Browser plugins: Poster (Firefox) Poster Postman (Chrome) Postman
DPLA API Key – Terminal Method
DPLA API Key – Postman Method Install Postman from Chrome Web Store (free)Postman Enter Request URL: Select method POST Click Send
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 Request &sourceResource.type=image&api_key=$YOUR_KEY &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)
Discovering Facet Options &facets=sourceResource.type,provider.name &api_key=$YOUR_KEY &facets=sourceResource.type,provider.name &api_key=$YOUR_KEY Facet: Type Facet: Provider Name
Designing a DPLA Advanced Search See for ideas:
DPLA Apps
Getting Code
API Key API Query
App Wishlist
App Wishlist
visit dp.la