-
Notifications
You must be signed in to change notification settings - Fork 0
Volume API
This API enables some endpoints to support catalog search in libraries.
- Main code: https://github.com/hathitrust/catalog/blob/main/static/api/volumes.php
- Public Documentation: https://www.hathitrust.org/member-libraries/resources-for-librarians/data-resources/bibliographic-api/
The rewrite rules in .htaccess are responsible for mapping api/volumes/... endpoints into static/api/volumes.php?... URLs
There are four variations on Bib API endpoints. The components will be abbreviated as follows:
-
b - brevity:, usually but not always enforced to be in
{brief, full}- The difference between a
briefandfullis that a completeMARC-XMLis returned in afullresponse.
- The difference between a
-
t - type: the output format is always
json, no other output formats are implemented. -
qf - query_field, fields defined on the Catalog Solr index to retrieve a record. The API allows Solr queries with the following fields
- recordid,
- sysid
- oclc
- htid
- issn
- isbn
- lccn
- umid. To see what each field means, access the public documentation.
-
qv - query value , such as
mdp.39015048895836 -
Q, which is
qf (query_field)combined withqv (query_value), e.g.,htid:mdp.39015048895836-
Q may have multiple values for a field, e.g.,
htid:mdp.39015048895836|mdp.39015004074095(treated as an OR and that allows for retrieving up to 20 records at a time) -
Q may have multiple fields or id types, e.g.,
htid:mdp.39015048895836;oclc:7107072(treated as an AND, you will use different fields to find a record.) - The exact semantics are not entirely clear from the documentation and are buried in the code
-
Q may have multiple values for a field, e.g.,
In order of appearance in .htaccess, they are:
-
brevity/type/Query
- e.g.
/api/volumes/full/json/htid:mdp.39015048895836 - This form can be used to perform more complex queries with Q
- The public documentation calls this "The multi-id request format."
- e.g.
-
brevity/query_field/query_value.type
- e.g.
/api/volumes/full/htid/mdp.39015048895836.json - The public documentation calls this the "Simple, single-identifier API"
- e.g.
-
type/Query
- implies brevity
brief - e.g. https://catalog.hathitrust.org/api/volumes/htid/mdp.39015004074095.json
- implies brevity
-
query_field/query_value.t
- implies brevity
brief - e.g. https://catalog.hathitrust.org/api/volumes/json/htid:mdp.39015004074095
- implies brevity
According to the code (lines 94-106), these fields are supported:
- htid / ht_id - HathiTrust item ID
- oclc - OCLC number
- isbn - ISBN
- issn - ISSN
- lccn - Library of Congress Control Number
- recordnumber / recordid / sysid / umid - Catalog record identifiers
- Query by HathiTrust ID (htid)
- Query by OCLC Number
https://catalog.hathitrust.org/static/api/volumes.php?q=oclc:7107072&type=json&brevity=full
- Query by ISBN
http://catalog.hathitrust.org/static/api/volumes.php?q=isbn:9780123456789&type=json&brevity=full
- Query by Record Number
http://catalog.hathitrust.org/static/api/volumes.php?q=recordnumber:000012345&type=json&brevity=full
- Query by ISSN
http://catalog.hathitrust.org/static/api/volumes.php?q=issn:1234-5678&type=json&brevity=full
- Query by LCCN
http://catalog.hathitrust.org/static/api/volumes.php?q=lccn:2001012345&type=json&brevity=full
Multiple Queries (OR logic)
Use | to separate multiple queries:
http://catalog.hathitrust.org/static/api/volumes.php?q=oclc:12345678|oclc:87654321&type=json&brevity=full
- JSON (default structured output)
- JSONP (with callback)
- Optional Parameters
Include Full MARC-XML
- Unwrap Single Results
-
https://catalog.hathitrust.org/static/api/volumes.php?q=htid:hvd.ah6h7u&type=json&brevity=full&single=1 This would return JSON with full MARC-XML for that specific HathiTrust item.
-
https://catalog.hathitrust.org/api/volumes/full/oclc/007107072.json
-
https://catalog.hathitrust.org/api/volumes/brief/oclc/007107072.json