Services¶
List of services, with their technologies, endpoints, and examples
DRUM¶
The Digital Repository at the University of Maryland (DRUM) collects, preserves, and provides public access to the scholarly output of the university. Faculty and researchers can upload research products for rapid dissemination, global visibility and impact, and long-term preservation.
OAI-PMH¶
Endpoint: https://api.drum.lib.umd.edu/server/oai/request
Example:
curl "https://api.drum.lib.umd.edu/server/oai/request?verb=Identify"
curl "https://api.drum.lib.umd.edu/server/oai/request?verb=ListSets"
curl "https://api.drum.lib.umd.edu/server/oai/request?verb=ListMetadataFormats"
Additional Examples:
drum-oaipmh.py
Use OAI-PMH to harvest metadata in DRUM.
OpenSearch¶
Endpoint: https://api.drum.lib.umd.edu/server/opensearch/search
Example: drum-search.py
#!/usr/bin/env python3
import urllib.request
from xml.etree import ElementTree
# Search DRUM using OpenSearch
ENDPOINT = 'https://api.drum.lib.umd.edu/server/opensearch/search'
def search(**params):
''' Search DRUM using OpenSearch, using named parameters '''
# Build the URL
params['rpp'] = 5 # get first 5 results
search_url = ENDPOINT + '?' + urllib.parse.urlencode(params)
print('\n========================')
print(f'Search URL: {search_url}')
# Get search results as parsed XML
with urllib.request.urlopen(search_url) as request:
atom = ElementTree.parse(request).getroot()
# Iterate over the returned items
for element in atom.findall('{http://www.w3.org/2005/Atom}entry'):
# Extract Item information
title = element.find('{http://www.w3.org/2005/Atom}title').text
handle_url = element.find('{http://www.w3.org/2005/Atom}link').get('href')
author = element.find('{http://www.w3.org/2005/Atom}author/{http://www.w3.org/2005/Atom}name').text
print('----')
print(f'Title: {title}')
print(f'Author: {author}')
print(f'Handle URL: {handle_url}')
# phrase is "Black Lives Matter"
search(query='"Black Lives Matter"')
# advisor is smela
# collection is 1903/2795 (Mechanical Engineering ETDs)
search(query='advisor:smela', scope='1903/2795')
# community is 1903/2278 (Library Staff Research Works)
search(query='*:*', scope='1903/2278')
DSpace REST API¶
Endpoint: https://api.drum.lib.umd.edu/server/api
The endpoint is explorable using the HAL Browser at https://api.drum.lib.umd.edu/server.
#!/usr/bin/env python3
import urllib.request
import json
# Get a list of items from DRUM using the REST API
ENDPOINT = 'https://api.drum.lib.umd.edu/server/api'
items_url = ENDPOINT + '/discover/browses/title/items'
# Get JSON results
with urllib.request.urlopen(items_url) as request:
response = json.loads(request.read())
# Iterate over the returned items
for item in response['_embedded']['items']:
md = item['metadata']
if 'dc.identifier.uri' in md:
link = "; ".join(entry['value'] for entry in md['dc.identifier.uri'])
else:
link = "n/a"
if 'dc.title' in md:
title = "; ".join(entry['value'] for entry in md['dc.title'])
else:
title = "n/a"
print('----')
print(f'Title: {title}')
print(f'Link: {link}')
Additional Example:
drum-harvest.py
Harvest metadata and files for every item in DRUM.
Digital Collections¶
University of Maryland Libraries’ Digital Collections
OAI-PMH¶
Endpoint: https://digital.lib.umd.edu/oaicat/OAIHandler
Example:
curl "https://digital.lib.umd.edu/oaicat/OAIHandler?verb=Identify"
curl "https://digital.lib.umd.edu/oaicat/OAIHandler?verb=ListSets"
curl "https://digital.lib.umd.edu/oaicat/OAIHandler?verb=ListMetadataFormats"
Digital Collections Audio/Video¶
University of Maryland Libraries’ Digital Collections Audio/Video Content
OpenSearch¶
OpenSearch Description: https://av.lib.umd.edu/catalog/opensearch.xml
JSON Endpoint: https://av.lib.umd.edu/catalog.json
Example:
PARAMS='search_field=all_fields&q=athletics'
curl "https://av.lib.umd.edu/catalog?$PARAMS"
curl "https://av.lib.umd.edu/catalog.rss?$PARAMS"
Example: digital-collections-av-search.py
#!/usr/bin/env python3
import urllib.request
import json
# Search Digital Collections Audio/Video using JSON OpenSearch
BASE = 'https://av.lib.umd.edu/'
ENDPOINT = 'https://av.lib.umd.edu/catalog.json'
# Keyword query on 'Maryland'
params = {
"search_field": "all_fields",
"q": "maryland",
}
search_url = ENDPOINT + '?' + urllib.parse.urlencode(params)
# Get search results as parsed XML
with urllib.request.urlopen(search_url) as request:
response = json.loads(request.read())
# Iterate over the returned items
for item in response['data']:
link = item['links']['self']
title = item['attributes']['title_tesi']['attributes']['value']
print('----')
print(f'Title: {title}')
print(f'Link: {link}')
BTAA Geoportal¶
The Big Ten Academic Alliance (BTAA) Geoportal connects users to digital geospatial resources, including GIS datasets, web services, and digitized historical maps from multiple data clearinghouses and library catalogs. The site is solely a search tool and does not host any data.
OpenSearch¶
OpenSearch Description: https://geo.btaa.org/catalog/opensearch.xml
RSS+XML Endpoint: https://geo.btaa.org/?format=rss
JSON Endpoint: https://geo.btaa.org/?format=json
The OpenSearch API is not officially documented by the Geoportal Documentation page.
Example: The RSS+XML and JSON endpoints operate using the same set of URL parameters used by the website interface, eg these curl commands return the same result set:
curl "https://geo.btaa.org/?search_field=all_fields&q=maryland"
curl "https://geo.btaa.org/?search_field=all_fields&q=maryland&format=rss"
curl "https://geo.btaa.org/?search_field=all_fields&q=maryland&format=json"
Example: geoportal-search.py
#!/usr/bin/env python3
import urllib.request
import json
# Search BTAA Geoportal using JSON OpenSearch
ENDPOINT = 'https://geo.btaa.org/'
# Keyword query on 'Maryland'
params = {
"search_field": "all_fields",
"q": "maryland",
"format": "json",
}
# https://geo.btaa.org/?search_field=all_fields&q=maryland&format=json
search_url = ENDPOINT + '?' + urllib.parse.urlencode(params)
print(search_url)
# Get search results as parsed XML
with urllib.request.urlopen(search_url) as request:
response = json.loads(request.read())
# Iterate over the returned items
for item in response['data']:
link = item['links']['self']
if ('attributes' in item
and 'dct_description_sm' in item['attributes']):
title = item['attributes']['dct_description_sm']['attributes']['value']
else:
title = "??"
print('----')
print(f'Title: {title}')
print(f'Link: {link}')