- Library Home /
- Search Collections /
- Open Collections /
- API Documentation
Open Collections
API Documentation
The Open Collections API
UBC Library Open Collections provides direct programmatic access to all of the metadata and much of the media available on the website through our APIs.
Three different Open Collections API Endpoints are available to meet a variety of use cases:
- The Open Collections REST API provides access to all collection and item-level metadata and full text transcripts, as well as the ElasticSearch search index for complex queries.
- The Open Collections OAI-PMH API provides access to item-level metadata programmatically or for harvesting by compatible software.
- The Open Collections IIIF API provides access to images and associated metadata programmatically or for use with IIIF-compatible image viewers.
To use the Open Collections APIs, you should first register for an API Key: Unregistered users will be limited in the number of requests that can be made.
Before using the APIs, please review and comply with our terms of use.
More information on using each of the API Endpoints can be found below. If you have feedback, questions, or want to share work that you've done using the API, please get in touch!
Quick Start
Know your way around an API and want to dive right in? Here's the essential for getting up and running with the REST API:
- https://oc-index.library.ubc.ca is the base URL of the Open Collections API.
- Register for an API key and append &api_key=[:YOUR_API_KEY] (where [:YOUR_API_KEY] to any requests you make.
- Review the API Reference section for a full list of search endpoints, collection nicknames, metadata fields, and output formats.
API Keys
To control abuse, users are encouraged to register their email address to receive an Open Collections API Key. The API Key is a string of characters that is appended to your API Request to show that it originates from a verified source. Unregistered users will be limited in the number of requests that can be made.
Open Collections API Keys are valid for all three of our APIs.API Basics
What is an API?
At its most basic, an API, or Application Programming Interface, is made up of a set of defined methods that someone can use to communicate with a (often complex) software system, and get back responses in a way that a computer (and, with some practice, a human) can understand.
In essence, an API defines the 'language' a system speaks. Like a language, it has its own vocabulary with terms that have special meanings (e.g., property names and labels), grammar (how those property names and labels are arranged collectively, its schema), and syntax (i.e., how the information itself is arranged). Like a language, you can use it to ask questions and understand responses. And like a language, with a little practice, it can be a powerful and extensible tool for communication.
A request is a URL sent to the web server over HTTP with the expectation of getting resource items back in the form of human-readable text or data. The URL supplies the web server with everything it needs to create and return a correct response. This is called a RESTful approach to API design and is employed by the Open Collections API.
How do I use it?
- Register an API Key
- Construct a query to request item and collection metadata or search results
- Use your web browser, a browser plugin like Postman, or your custom code to make your request
- Read the response
Constructing a Request
Most data from the Open Collections API can be accessed with simple HTTP GET requests. These type of requests look essentially like the URL of a regular web page, but return data objects rather than HTML markup. These URLs can have two parts:
- A URL or "endpoint" that indicates where to direct the query. The Open Collections API base URL is: https://oc-index.library.ubc.ca . See below for a full list of available endpoints .
- A query string consisting of parameters that describe the data being requested. This is used for search requests, and for appending your API to your request.
For example, the following URL represents a request for a list of all the collections in Open Collections, with a mock API key appended as a parameter:
https://oc-index.library.ubc.ca/collections?key=b50f846f393620b298cbfe96549f2f
Parsing A Response
The Open Collections API returns responses in JSON format by default, and some endpoints can return other formats on request. See the API Reference section for more details.
Tip: Browser extensions such as the Chrome JSON Formatter can make viewing and working with JSON in your browser much easier.
Tip: JSON stores data in 'objects,' that do not always translate easily into tabular formats, but tools such as this JSON to CSV converter or Open Refine can help you get API data into a spreadsheet or table if that's what you need.
Learn More: UBC Library Research Commons
The UBC Library Research Commons provides support and training for UBC students and researchers who are interested in learning to use APIs. Sign up for a workshop or consultation at https://researchcommons.library.ubc.ca, or check out the course materials from their Introduction to APIs workshop on GitHub.The Open Collections REST API
Metadata Endpoints
Collection and item metadata is requested from the Open Collections API by querying specifically structured
endpoints. All metadata endpoints begin with the API base url, https://oc-index.library.ubc.ca
, followed by a
specific path for the collection and item being requested.
Collections
A collection is a reference to a set of items indexed in Open Collections. Collections have two
RESTful endpoints associated with them, a /collections/
endpoint that returns information about the
collection, and and a /collections/.../items/
endpoint that lists the contents of the collection.
Collection Metadata
The collection metadata endpoints return data describing the contents of a collection.
The collections endpoints are constructed as follows, where
[:name]
is the nickname of a collection in Open Collections:
https://oc-index.library.ubc.ca/collections/[:name]
For example, the following endpoint returns the metadata associated with the Berkeley Posters Collection:
https://oc-index.library.ubc.ca/collections/berkpost
Mappings for all collection nicknames are available here .
Collection Items
The collections items endpoints return a list all items in a collections. There are two types of collection items endpoints, one returns a simple list of all items in a collection (ids only), and the other returns a paginated list of all items in the collection with a richer subset of metadata.
The collection items endpoints to return a full list of items are constructed as follows, where
[:name]
is the nickname of the collection:
https://oc-index.library.ubc.ca/collections/[:name]/items
For example, the following returns a list of all items in the Arkley collection:
https://oc-index.library.ubc.ca/collections/arkley/items
To return a paginated list of items with richer metadata, add the limit
and offset
parameters
as in the example below, where
[:limit]
is the number of items to return per page,
and
[:offset]
is the index of the first item on the page (i.e. with a page size of 10, the second page would start with
the offset 10).
https://oc-index.library.ubc.ca/collections/[:name]/items?limit=[:limit]&offset[:offset]
For example, the following returns the first ten items from the the Arkley collection:
https://oc-index.library.ubc.ca/collections/arkley/items?limit=10&offset=0
Item Metadata
An "item" in open collection is typically a single piece of content indexed in Open Collections. The content can be,
for example, a book, an image, a video, and in some cases can have multiple components (ie. a PDF and an audio file).
The /item/
endpoint returns data
The following request returns the metadata for a specific item, where
[:name]
is the nickname of the item's parent collection, and
[:itemId]
is the item's unique identifier:
https://oc-index.library.ubc.ca/collections/[:name]/items/[:itemId]
For example, the following returns the metadata from a single item in the the Arkley collection:
https://oc-index.library.ubc.ca/collections/arkley/items/1.0013125
Tip: You can grab the requisite
[:name]
and
[:itemId]
values from the collection/.../items
endpoint.
Search Endpoint
The Open Collections /search/[:api_version]/
endpoint returns search results and metadata from the
system's ElasticSearch index, where [:api_version] is the version of ElasticSearch syntax to use (currently we are
supporting 8.5). The endpoint supports GET requests with a limited subset of parameters, and more
complete access to the full ElasticSearch feature set via POST request (see Advanced Usage).
Basic Searching (GET Requests)
This endpoint returns a basic set of search results, and [:query] is your query string. The endpoint supports basic strings and Lucene query syntax :
https://oc-index.library.ubc.ca/search/8.5?q=[:query]
For example, the following will submit a search for the term "cat":
https://oc-index.library.ubc.ca/search/8.5?q=cat
To limit your search to a specific collection, you can use the 'index' parameter where [:index] is the nickname of the collection or collections you would like to search (multiple collection nicknames can be combined with commas):
https://oc-index.library.ubc.ca/search/8.5?q=[:query]&index=[:index]
For example, the following will submit a search for the term "cat" in the Tremaine Arkley Croquet Collections and The Alice Arm and Anyox Herald newspaper collection:
https://oc-index.library.ubc.ca/search/8.5?q=cat&index=arkley
To limit your search to a specific metadata value, you can use the 'term' parameter where [:field] is the name of the metadata field, and [:term] is the value you would like to match. Multiple fields and terms can be specified, separated by semicolons:
https://oc-index.library.ubc.ca/search/8.5?q=[:query]&term=[:field],[:term];[:field],[:term]
For example, the following will submit a search for the term "cat" where "Type" is "Still Image" and "creator" is "Kull, Bob". Note that adding ".raw" to the field name enforces an exact match, and that the values are URI-encoded to prevent errors:
https://oc-index.library.ubc.ca/search/8.5?q=cat&term=creator.raw,Kull%2C%20Bob;type.raw,Still%20Image
See the full
list of supported parameters
in the API Reference or at
https://oc-index.library.ubc.ca/search/help
. Note that parameter values should be
URI-encoded
to avoid errors.
Advanced Usage
For more advanced use cases, the Open Collections Search API provides access to the full power of its underlying ElasticSearch index, including aggregations (useful for data visualization and analysis), advanced searching and filtering, geolocation, and much more (everything except custom script fields).
ElasticSearch version 8.5 Query DSL objects can be submitted to the
/search/8.5/
endpoint via POST request and can be combined with the Open Collections
search URI parameters. Query DSL object values will take precedence over URI parameter values.
Learn more about the ElasticSearch API:
- Search API documentation
- Query DSL documentation
- Aggregations
- Dealing with Human Language
- Geolocation
REST API Reference
API Endpoints
The following endpoints are available for use:
Method | Endpoint | Description | Status |
---|---|---|---|
GET | collections | Returns a list of all collections | Online |
GET | collections/:collection_identifier | Returns the metadata for a specific collection | Online |
GET | collections/:collection_identifier/download/collection | Returns a GZIP download of a specific collection's metadata | Online |
GET | collections/:collection_identifier/items | Returns a list of all items for a specific collection | Online |
GET | collections/:collection_identifier/items/:item_identifier | Returns the metadata for a specific collection's single item | Online |
GET | collections/:collection_identifier/_total | Returns the item count of a specific collection | Online |
GET | /search/help | Returns list of accepted OC Search API query parameters. | Online |
GET | /search/8.5 | Accepts OC Search API parameters, returns search results. | Online |
POST | /search/8.5 | Accepts ElasticSearch 8.5 Query DSL objects, returns search results, aggregation data, and more. | Online |
Collections
Collection ID | Collection Name |
---|---|
ubcstuhan | AMS Student Handbooks |
ams | Alma Mater Society Image Collection |
59371 | American Physical Society Northwestern Section Annual Meeting (APS-NW) (11th : 2009) |
artefacts | Ancient Artefacts |
mccormick | Andrew McCormick Maps and Prints |
auce | Association of University and College Employees (AUCE) fonds |
bcbooks | BC Historical Books |
bcdocs | BC Historical Documents |
bcsessional | BC Sessional Papers |
48630 | BIRS Workshop Lecture Videos |
berkpost | Berkeley 1968-1973 Poster Collection |
biblos | Biblos |
bch | British Columbia History |
59367 | British Columbia Mine Reclamation Symposium |
ccmms | CCS - Chinese Canadian Military Museum Society |
chockon | CCS - Chock On Fong Fonds |
gri | CCS - Gorsebrook Research Institute for Atlantic Studies |
loktin | CCS - Henry Lok-Tin Lee |
instrcc | CCS - INSTRCC |
kcca | CCS - Kamloops Chinese Cultural Association |
louie | CCS - Louie Papers |
normankwong | CCS - Norman Kwong Collection |
bicklee | CCS - Ron Bick Lee Fonds |
wahshun | CCS - Wah Shun Company |
85451 | CES Speaker Series |
59370 | Canadian Summer School on Quantum Information (CSSQI) (10th : 2010) |
capilano | Capilano Timber Company Fonds |
darwin | Charles Darwin Letters |
chineserare | Chinese Rare Books |
chungobject | Chung Objects |
chungosgr | Chung Oversize and Graphic Materials |
chungphotos | Chung Photographs |
chungpub | Chung Published Works |
chungtext | Chung Textual Materials |
citraudio | CiTR Audiotapes |
59404 | Congress of the Humanities and Social Sciences (77th : 2008) |
46624 | Consortium for Nursing History Inquiry |
cg | Creative Giving |
77752 | Crime and Punishment at 150 (2016) |
davidconde | David Conde Fonds |
davidsonia | Davidsonia |
delgamuukw | Delgamuukw Trial Transcripts |
55474 | Digital Library Federation (DLF) (2015) |
discorder | Discorder |
dorothyburn | Dorothy Burnett Bookbinding Tools |
djcox | Doug and Joyce Cox Research Collection |
24 | Electronic Theses and Dissertations (ETDs) 2008+ |
ecrosby | Emma Crosby Letters |
squeezes | Epigraphic Squeezes |
etheljohns | Ethel Johns Fonds |
focus | FOCUS |
52383 | Faculty Research and Publications |
first100theses | First Hundred Theses |
fisherman | Fisherman Publishing Society Collection |
florence | Florence Nightingale Letters |
frenchrevo | French Revolution |
germanconsulate | German Consulate fonds |
42591 | Graduate Research [non-thesis] |
gvrdmaps | Greater Vancouver Regional District Planning Department Land Use Maps |
bullock | H. Bullock-Webster fonds |
stravinsky | H. Colin Slim Stravinsky Collection |
hawthorn | Hawthorn Fly Fishing & Angling Collection |
hdoyle | Henry Doyle Fonds |
childrenlit | Historical Children's Literature Collection |
nursing | History of Nursing |
bbmnhibc | Images of Natural History Specimens from the Beaty Biodiversity Museum at UBC |
iel | Indian Education Newsletter |
feeders | Infant Feeders Collection |
59405 | Insights from Nuclear Magnetic Resonance (NMR) : A symposium in honour of Myer Bloom (1993) |
ifcsm | Interim Forest Cover Series Maps |
59585 | International Conference of Institutes and Libraries for Chinese Overseas Studies (WCILCOS) (5th : 2012) |
53032 | International Conference on Applications of Statistics and Probability in Civil Engineering (ICASP) (12th : 2015) |
52657 | International Conference on Engineering Education for Sustainable Development (EESD) (7th : 2015) |
59278 | International Conference on Gas Hydrates (ICGH) (6th : 2008) |
53926 | International Conference on Health Promoting Universities and Colleges (7th : 2015) |
52660 | International Construction Specialty Conference of the Canadian Society for Civil Engineering (ICSC) (5th : 2015) |
62152 | International Institute for Critical Studies in Improvisation (IICSI) Colloquium |
59406 | Investigating Our Practices (IOP) |
67657 | Irving K. Barber Learning Centre Events |
jphotos | Japanese Canadian Photograph Collection |
tokugawa | Japanese Maps of the Tokugawa Era |
jsc | Japanese Special Collection |
johnkeenlyside | John Keenlyside Legal Research Collection |
kamishibai | Kamishibai Propaganda Plays |
kinesis | Kinesis |
holland | Laura Holland Fonds |
67247 | Leader in Residence (Okanagan) |
67246 | Library History and Events |
494 | Library Staff Publications and Research |
creelman | Lyle Creelman Fonds |
macmillan | MacMillan Bloedel Limited fonds |
meiji150 | Meiji at 150 |
81709 | Meiji at 150 Podcast |
59369 | Metropolis British Columbia Policy Research Symposium (MBC) (2008) |
upubmisc | Miscellaneous Documents |
mpauline | Mme. Pauline Donalda Collection |
42446 | Multidisciplinary Undergraduate Research Conference (MURC) |
60499 | NEXUS Spring Institute |
agassiz | Newspapers - Agassiz Record |
xalberniadv | Newspapers - Alberni Advocate |
albernip | Newspapers - Alberni Pioneer News |
argus | Newspapers - Argus |
armstrongad | Newspapers - Armstrong Advance |
arlaadvo | Newspapers - Arrow Lake Advocate |
bcln | Newspapers - BC Labor News (Vancouver) |
bclumber | Newspapers - BC Lumberman (Vancouver) |
bctu | Newspapers - BC Trades Unionist (Vancouver) |
xbellacoo | Newspapers - Bella Coola Courier |
bensun | Newspapers - Bennett Sun |
bcbr | Newspapers - British Columbia Building Record |
bcfed | Newspapers - British Columbia Federationist |
bcmining | Newspapers - British Columbia Mining Journal |
bcm | Newspapers - British Columbia Musician |
bcnews | Newspapers - British Columbia News |
xbcrecord | Newspapers - British Columbia Record |
bcret | Newspapers - British Columbia Retailer |
bct | Newspapers - British Columbia Tribune (Yale) |
brooklynnews | Newspapers - Brooklyn News |
cflacla | Newspapers - Canadian Farmer Labor Advocate and Canadian Labor Advocate |
canford | Newspapers - Canford Radium |
cascade | Newspapers - Cascade Record |
cassiarnews | Newspapers - Cassiar News (Stewart) |
chasetrib | Newspapers - Chase Tribune |
chilliwackfp | Newspapers - Chilliwack Free Press |
citizennw | Newspapers - Citizen - New Westminister |
cwhustler | Newspapers - Clanwilliam Hustler |
coalmont | Newspapers - Coalmont Courier |
coasmine | Newspapers - Coast Miner (Van Anda) |
columbiarev | Newspapers - Columbia Review |
courtenayrev | Newspapers - Courtenay Review |
cwn | Newspapers - Courtenay Weekly News |
cranherald | Newspapers - Cranbrook Herald |
croftongaz | Newspapers - Crofton Gazette and Cowichan News |
cumberlandis | Newspapers - Cumberland Islander |
dbc | Newspapers - Daily British Columbian |
xdbr | Newspapers - Daily Building Record |
enterprise | Newspapers - Duncan Enterprise |
eastkootmine | Newspapers - East Kootenay Miner (Golden) |
echo | Newspapers - Echo (Duncan) |
epnoh | Newspapers - Enderby Progress and Northern Okanagan Herald |
eveningt | Newspapers - Evening Telegraph (Victoria) |
evewoross | Newspapers - Evening World (Rossland) |
fgherald | Newspapers - Fort George Herald |
fraseradvanc | Newspapers - Fraser Advance (Chilliwack) |
gcdb | Newspapers - General Conference Daily Bulletin (Victoria) |
glennews | Newspapers - Glenora News |
goldenera | Newspapers - Golden Era |
goldentimes | Newspapers - Golden Times |
gvchinook | Newspapers - Greater Vancouver Chinook |
hqueek | Newspapers - Hazelton Queek |
xhotsprings | Newspapers - Hot Springs News (Ainsworth) |
htbva | Newspapers - Hubert Times and Bulkley Valley Advertiser |
indworld | Newspapers - Industrial World (Rossland) |
kwawa | Newspapers - Kamloops Wawa |
xkelownarec | Newspapers - Kelowna Record and The Orchard City Record |
kerechro | Newspapers - Keremeos Chronicle |
kootstar | Newspapers - Kootenay Star (Revelstoke) |
laborstar | Newspapers - Labor Star (Vancouver) |
ladysmithl | Newspapers - Ladysmith Leader |
ladysmithr | Newspapers - Ladysmith Recorder |
ladysmithsi | Newspapers - Ladysmith Signal |
ladysmithst | Newspapers - Ladysmith Standard |
ardeau | Newspapers - Lardeau Eagle (Ferguson) |
lardeaum | Newspapers - Lardeau Mining Review (Trout Lake) |
leadera | Newspapers - Leader Advocate (Vancouver) |
locla | Newspapers - Lowery's Claim |
mherald | Newspapers - Mail Herald (Revelstoke) |
michelr | Newspapers - Michel Recorder |
morninglnw | Newspapers - Morning Ledger - New Westminster |
mpadvocate | Newspapers - Mount Pleasant Advocate (Vancouver) |
ndaymine | Newspapers - Nelson Daily Miner |
nelsondaily | Newspapers - Nelson Daily News |
nwminer | Newspapers - Nelson Weekly Miner |
nwdn | Newspapers - New Westminster Daily News |
newestimes | Newspapers - New Westminster Times |
nicoheral | Newspapers - Nicola Herald |
norcoa | Newspapers - North Coast (Port Simpson) |
omr | Newspapers - Okanagan Mining Review |
omineca | Newspapers - Omineca Herald (Hazelton) |
ominecaminer | Newspapers - Omineca Miner (Hazelton) |
paccannw | Newspapers - Pacific Canadian (New Westminster) |
paystreak | Newspapers - Paystreak (Sandon) |
peloyalist | Newspapers - Port Essington Loyalist |
pmgazette | Newspapers - Port Moody Gazette |
prj | Newspapers - Prince Rupert Journal |
princero | Newspapers - Prince Rupert Optimist |
pwv | Newspapers - Progress and Week – Victoria |
cranbrookpro | Newspapers - Prospector (Cranbrook) |
proslill | Newspapers - Prospector (Lillooet) |
prossross | Newspapers - Prospector (Rossland) |
qcminer | Newspapers - Quartz Creek Miner |
qcislander | Newspapers - Queen Charlotte Islander |
redflag | Newspapers - Red Flag (Vancouver) |
xrevherald | Newspapers - Revelstoke Herald |
sfjcbce | Newspapers - San Francisco Journal of Commerce B.C. Edition (Victoria) |
satworld | Newspapers - Saturday World (Rossland) |
silsil | Newspapers - Silverton Silvertonian |
similkameen | Newspapers - Similkameen Star |
slodrill | Newspapers - Slocan Drill |
smreview | Newspapers - Slocan Mining Review |
slocanp | Newspapers - Slocan Prospector |
slorec | Newspapers - Slocan Record |
sgazette | Newspapers - Surrey Gazette |
surreytimes | Newspapers - Surrey Times (Cloverdale) |
xabpost | Newspapers - The Abbotsford Post |
advance | Newspapers - The Advance (Midway) |
alderstar | Newspapers - The Aldergrove Star |
aaah | Newspapers - The Alice Arm and Anyox Herald |
xanaconda | Newspapers - The Anaconda News |
xatlin | Newspapers - The Atlin Claim |
bcweekly | Newspapers - The B.C. Weekly News |
xboundarycr | Newspapers - The Boundary Creek Times |
xcariboosen | Newspapers - The Cariboo Sentinel (Barkerville) |
xcoastnews | Newspapers - The Coast News (Gibsons) |
commonr | Newspapers - The Common Round |
xcrestonrev | Newspapers - The Creston Review |
xcumberland | Newspapers - The Cumberland News |
dcanadi | Newspapers - The Daily Canadian |
xdailyledg | Newspapers - The Daily Ledger (Ladysmith) |
daytele | Newspapers - The Daily Telegram |
deltnews | Newspapers - The Delta News |
delttime | Newspapers - The Delta Times |
despatch | Newspapers - The Despatch (Morrissey) |
disledfer | Newspapers - The District Ledger (Fernie) |
xenderby | Newspapers - The Enderby Press and Walker's Weekly |
evenkoot | Newspapers - The Evening Kootenaian |
expressnv | Newspapers - The Express (North Vancouver) |
fernieled | Newspapers - The Fernie Ledger (Fernie) |
gfminer | Newspapers - The Grand Forks Miner |
xgrandforks | Newspapers - The Grand Forks Sun |
greemine | Newspapers - The Greenwood Miner |
xhedley | Newspapers - The Hedley Gazette |
htimes | Newspapers - The Hosmer Times |
xindependen | Newspapers - The Independent (Vancouver) |
koolib | Newspapers - The Kootenay Liberal |
xkootmail | Newspapers - The Kootenay Mail |
labours | Newspapers - The Labour Statesman |
ledgefern | Newspapers - The Ledge (Fernie) |
xledgreen | Newspapers - The Ledge (Greenwood) |
ledge | Newspapers - The Ledge (Nakusp) |
ledgenel | Newspapers - The Ledge (Nelson) |
xnakledge | Newspapers - The Ledge (New Denver) |
lilladva | Newspapers - The Lillooet Advance |
marytrib | Newspapers - The Marysville Tribune |
xmassett | Newspapers - The Massett Leader |
xminer | Newspapers - The Miner (Nelson) |
xminingrev | Newspapers - The Mining Review (Sandon) |
misscity | Newspapers - The Mission City News |
mmention | Newspapers - The Morrissey Mention |
mminer | Newspapers - The Morrissey Miner |
xmoyie | Newspapers - The Moyie Leader |
nanacour | Newspapers - The Nanaimo Courier |
nanamail | Newspapers - The Nanaimo Mail |
xnelsonecon | Newspapers - The Nelson Economist |
xnicola | Newspapers - The Nicola Valley News (Merritt) |
thenugget | Newspapers - The Nugget |
xpentimes | Newspapers - The Peninsula Times |
penpress | Newspapers - The Penticton Press |
xphoenix | Newspapers - The Phoenix Pioneer |
xprospector | Newspapers - The Prospector (Fort Steele) |
thestar | Newspapers - The Star (Port Essington) |
thesun | Newspapers - The Sun (Port Essington) |
xtribune | Newspapers - The Tribune (Nelson) |
vancouverw | Newspapers - The Vancouver Weekly Herald and North Pacific News |
thewave | Newspapers - The Wave (Victoria) |
xwestcall | Newspapers - The Western Call (Vancouver) |
truthd | Newspapers - Truth - Donald |
vslp | Newspapers - Valley Sentinel - Langley Prairie |
vanad | Newspapers - Vancouver Advertiser |
vanbuildrec | Newspapers - Vancouver Building Record |
beaverdell | Newspapers - West Forks News (Beaverdell) |
wclarion | Newspapers - Western Clarion (Vancouver) |
westho | Newspapers - Westward Ho! |
ymirherald | Newspapers - Ymir Herald |
ymirminer | Newspapers - Ymir Miner |
ymirmirror | Newspapers - Ymir Mirror |
ohs | Okanagan Historical Society Reports |
hundred | One Hundred Poets | 百人一首 |
67656 | Open Access Week |
prism | PRISM international |
pedestal | Pedestal |
anderson | Peter Anderson fonds |
presrep | Presidents’ Reports |
75346 | Psychology Undergraduate Research Conference (PURC) |
punjabip | Punjabi Patrika |
mathison | R. Mathison Collection |
bookplate | RBSC Bookplates |
rainbow | Rainbow Ranche Collection |
libsenrep | Report of the University Librarian to the Senate |
831 | Retrospective Theses and Dissertations, 1919-2007 |
rosetti | Rosetti Studios - Stanley Park Collection |
royalfisk | Royal Fisk Gold Rush Letters |
saga | SAGA Document Collection |
310 | SCARP Graduating Projects |
76471 | Sawchen Series |
51869 | Science One Research Projects |
senmin | Senate Minutes |
simpson | Simpson Family Fonds |
59374 | Symposium on Early Modern Japanese Values and Individuality (2013) |
51833 | TRIUMF Reports |
59368 | Tailings and Mine Waste Conference |
tairikunipp | Tairiku Nippō (Continental Daily News) |
bcreports | The British Columbia Reports |
alumchron | The Graduate Chronicle/The UBC Alumni Chronicle/Trek/The University of British Columbia Magazine |
shakespe | The Shakespeare First Folio |
touchpoints | Touchpoints |
tgdp | Traité général des pesches |
arkley | Tremaine Arkley Croquet Collection |
archivesav | UBC Archives Audio Recordings Collection |
arphotos | UBC Archives Photograph Collection |
ubcavafc | UBC Archives Video & Film Collection |
25332 | UBC Authors and Their Works Program, 1991-2006 |
calendars | UBC Calendars |
52387 | UBC Community and Partner Publications |
ubccong | UBC Congregation Video Collection |
31776 | UBC Faculty Publications Lists (1928-1969) |
31775 | UBC Historical Sound and Moving Image Collection |
ubchist | UBC History |
fisheries | UBC Institute of Fisheries Field Records |
43377 | UBC Japanese Canadian Students of 1942 |
67634 | UBC Lectures, Seminars, and Symposia |
ubcavfrc | UBC Legacy Video Collection |
specialp | UBC Library Digitization Centre Special Projects |
framed | UBC Library Framed Works Collection |
ubclibnews | UBC Library News |
ubclsb | UBC Library Staff Bulletin |
ubcmedicine | UBC Medicine |
53169 | UBC President's Speeches and Writings |
641 | UBC Press Publications, Supplements, and Catalogues |
ubcreports | UBC Reports |
researchdata | UBC Research Data |
66428 | UBC Social Ecological Economic Development Studies (SEEDS) Student Reports (Graduate) |
18861 | UBC Social Ecological Economic Development Studies (SEEDS) Student Reports (Undergraduate) |
ubctp | UBC Theatre Programmes |
ubcyearb | UBC Yearbooks |
ubysseynews | Ubyssey |
52966 | Undergraduate Research |
langmann | Uno Langmann Family Collection of British Columbia Photographs |
12708 | Vancouver Institute Lectures |
vma | Vancouver Medical Association |
wwposters | WWI & WWII Posters |
73804 | West Coast Conference on Formal Linguistics (WCCFL) (38th : 2020) |
manuscripts | Western Manuscripts and Early Printed Books |
westland | Westland |
58233 | Workshop for Instruction in Library Use (WILU) (45th : 2016) |
70440 | World Sanskrit Conference (WSC) (17th : 2018) |
wwiphoto | World War I British press photograph collection |
yipsang | Yip Sang Collection |
63300 | Ziegler Series |
33381 | cIRcle License Text |
32457 | iSchool (Library, Archival and Information Studies) Research Days |
the432 | 432 |
Fields
To view more about our metadata terms please view this page.
Search Parameters
The open collections https://oc-index.library.ubc.ca/search/8.5
endpoint accepts the following paremeters in GET requests:
Parameter | Description | Default Value | Notes |
---|---|---|---|
q | Query string | * | Accepts basic string or boolean query (lucene query syntax). should be uri encoded. |
size | Number of responses | 20 | |
from | Index of first result | 0 | Used to paginate through results (ie. use '19' to return results starting with the 20th hit) |
index | Search index | oc | Used to limit search to specific collections (use collection 'nickname'). 'oc' searches all content. supports multiple values (comma-separated) |
sort | How to sort results | _score,desc | Comma-separated: [:field],[:order]. accepts '_score' and metadata field names, and 'asc'/'desc' |
term | Filter by metadata field contents, must match all | Comma-separated: field,filter_on. supports multiple value pairs separated by semicolons. use [:field].raw to match full text of field value. | |
terms | Filter by metadata field contents, match any in a given field | Comma-separated: field,filter_on. supports multiple value pairs separated by semicolons. use [:field].raw to match full text of field value. | |
range | Limit to range of values for a metadata field | Comma-separated: field,gte,lte,date_format(date_format is optional. if not specified, the provided date will be matched with all available formats until a match is found). only works on numeric fields: e.g. sortdate accepts milliseconds. accepted date formats are: yyyy-mm-dd, yyyy-mm, y, date_time_no_millis, date_hour_minute_second, epoch_millis | |
source | Array of field names to return | Comma separated. if omitted a default set of metadata will be returned. | |
key | Api key | Requests without an api key will be rate limited |
Output Formats
Responses from the API are returned in JSON by default however there are a number of different formats available which we will show you how to request for below.
GET Requests
For GET requests you should replace
:outputFormat
in the URL below with the format you want returned:
https://oc-index.library.ubc.ca/collections/
[:name]
/items/
[:itemId]
/output-format/
[:outputFormat]
POST Requests
For POST requests you should set the HTTP Accept header to the format you want returned.
Available Formats
Description | GET Value | POST Value |
---|---|---|
Json conforming to ubc metadata manual | json | application/json |
Json-ld (with ubc property tags) | ubc+json | application/json |
Json-ld | ld | application/json |
Json-ld | ld+json | application/json |
Rdf/xml from json-ld (deprecated) | ld+rdf | application/xml |
Rdf+json rdf in json | rdf+json | application/xml |
Rdf/xml | rdf | application/xml |
Rdf/xml | xml | application/xml |
Xml stored at datacite (the metadata attached to the document doi) | datacite | application/xml |
Turtle stored at datacite (the metadata attached to the document doi) | dx | text/plain |
Turtle stored at datacite (the metadata attached to the document doi) | dx+turtle | text/plain |
Bibtex stored at datacite (the metadata attached to the document doi) | dx+bibtex | text/plain |
Ris stored at datacite (the metadata attached to the document doi) | dx+ris | text/plain |
Rdf stored at datacite (the metadata attached to the document doi) | dx+rdf | application/xml |
Plain text (turtle) | turtle | text/plain |
Plain text (ntriples) | ntriples | text/plain |
Just the item's fulltext (gosh all that full text!!) | plaintext | text/plain |
Example Scripts
Example scripts for working with the API in a variety of languages can be found on the UBC Library GitHub.
Get all items from a collection
To get all items from a collection you need to request the collection first and retrieve all its item ids and then loop through each item using the API.
Harvest full text of all items in a collection
Note: not all collections have full text, we've specifically chosen one of the smaller collections with full text to show you how to programmatically loop through items and export the full text.
Download Collection Data
This script should be run from a terminal window, it allows you to download items metadata into a format of your choosing using the API.
The Open Collections OAI-PMH API
What is OAI-PMH?
The Open Archives Initiative Protocol for Metadata Harvesting (OAI-PMH) provides an application-independent interoperability framework based on metadata harvesting. Open Collections’ OAI-PMH repository is a network accessible server that can process the 6 OAI-PMH requests to expose metadata to harvesters.
Note: To access Open Collections’ OAI-PMH you need to use a registered api_key in your request header. You can Register an API key if you don’t have one already. The following command shows how to add the api_key into request header using curl command:
Repository Info and Identifier Format
The Identify verb is used to retrieve information about the repository:
https://oce-index.library.ubc.ca/oai?verb=Identify
The server responds with XML data describing the repository characteristics including identifier format:
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<responseDate>2021-02-03T11:08:34Z</responseDate>
<request verb="Identify">https://oc2-index-dev-ah.library.ubc.ca/oai</request>
<Identify>
<repositoryName>Open Collections</repositoryName>
<baseURL>https://oce.library.ubc.ca/oai</baseURL>
<protocolVersion>2.0</protocolVersion>
<adminEmail>library.opencollections@ubc.ca</adminEmail>
<earliestDatestamp>2020-01-01T00:00:00Z</earliestDatestamp>
<deletedRecord>transient</deletedRecord>
<granularity>YYYY-MM-DDThh:mm:ssZ</granularity>
<description>
<oai-identifier xmlns="http://www.openarchives.org/OAI/2.0/oai-identifier"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai-identifier http://www.openarchives.org/OAI/2.0/oai-identifier.xsd">
<scheme>oai</scheme>
<repository>oc</repository>
<delimiter>:</delimiter>
<sampleIdentifier>oai:oc:1.0088719</sampleIdentifier>
</oai-identifier>
</description>
</Identify>
</OAI-PMH>
OAI-PMH Commands
Verb | Summary and Usage Notes | Example |
GetRecord | This verb is used to retrieve an individual metadata record from the repository. Required arguments: identifier, metadataPrefix |
https://oce-index.library.ubc.ca/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=oai:oc:1.0211973 |
Identify | This verb is used to retrieve information about the repository. | https://oce-index.library.ubc.ca/oai?verb=Identify |
ListIdentifiers | This verb is an abbreviated form of ListRecords
, retrieving only
headers
rather than
records
. Required arguments: metadataPrefix Optional arguments: from, until, set Exclusive arguments: resumptionToken |
https://oce-index.library.ubc.ca/oai?verb=ListIdentifiers&metadataPrefix=oai_dc&set=oc:cdm:chung:chungosgr&from=2020-12-24T13:19:00Z&until=2020-12-24T13:20:00Z |
ListMetadataFromats | This verb is used to retrieve the metadata formats available from the repository. Optional arguments: identifier |
https://oce-index.library.ubc.ca/oai?verb=ListMetadataFormats |
ListRecords | This verb is used to harvest records from the repository. Required arguments: metadataPrefix Optional arguments: from, until, set Exclusive arguments: resumptionToken ** |
https://oce-index.library.ubc.ca/oai?verb=ListRecords&metadataPrefix=oai_dc&set=oc:cdm:chung:chungosgr&from=2020-12-24T13:19:00Z&until=2020-12-24T13:20:00Z |
ListSets | This verb is used to retrieve the set structure of the repository, useful for
selective harvesting
. Exclusive arguments: resumptionToken |
https://oce-index.library.ubc.ca/oai?verb=ListSets
|
To learn more about the OAI-PMH and request/verb details please see http://www.openarchives.org/OAI/openarchivesprotocol.html
The Open Collections IIIF API
UBC Open Collections uses the International Image Interoperability Framework ("IIIF") standard to display image content in the site, and provides access to this API through the OC IIIF API endpoint. This endpoint can return images resized and modified to specific specifications as well as metadata ("manifests") associated with the images, and can be used to view content in a number of different IIIF-compatible viewers. Requests can be made to the Open Collections IIIF Endpoint using IIIF 2.0 syntax at:
https://iiif.library.ubc.ca
IIIF API References
Some basic examples are included below, but for full details on using the IIIF standard, including the specific syntax and parameters available please consult the official documentation here:
- IIIF Image API 2.0 Documentation for accessing media
- IIIF Presentation API 2.0 Documentation for accessing manifests and metadata
Note: When working with results from the Open Collections Metadata API the item identifiers need to have the dot replaced with a dash to work with the IIIF API. For instance '1.0001258' would become '1-0001258'
Example: Requesting a Specific Image Size
Once you've found an image you like, you can modify the URL to get the correct sized desktop background:
http://iiif.library.ubc.ca/image/cdm.tokugawa.1-0213163/full/1600,900/0/default.png
If we wanted to remove the excess borders we could replace 'full' in the [:region] part of the IIIF url with the crop coordinates:
http://iiif.library.ubc.ca/image/cdm.tokugawa.1-0213163/1145,374,9234,4645/1600,900/0/default.png