ab — API docs

Machine-readable spec: /openapi.json (OpenAPI 3.0)

GET/api/search?q=<query>&limit=20

Search books by title or author (case-insensitive substring match).

Request
curl "http://localhost:8000/api/search?q=sherlock"
Response
{
  "query": "sherlock",
  "count": 1,
  "results": [
    { "id": 1651, "source": "gutenberg", "title": "The Adventures of Sherlock Holmes",
      "authors": "Doyle, Arthur Conan, 1859-1930", "language": "en", "issued": "2008-05-13" }
  ]
}

GET/api/books/{id}

A single book's full record, plus every identifier known for it (ISBN, ASIN, OCLC, VIAF, Gutenberg ID, ... — whatever's been recorded, one row per identifier).

Request
curl "http://localhost:8000/api/books/1651"
Response
{
  "id": 1651, "source": "gutenberg", "source_native_id": "1661",
  "title": "The Adventures of Sherlock Holmes",
  "authors": "Doyle, Arthur Conan, 1859-1930", "language": "en",
  "subjects": ["Holmes, Sherlock (Fictitious character) -- Fiction", "..."],
  "identifiers": [
    { "type": "gutenberg_id", "value": "1661" },
    { "type": "locc", "value": "PR" }
  ]
}

GET/api/books/{id}/download

302-redirects to the book's actual file at its source. Only sources whose files are freely redistributable get a mapping here (currently: Gutenberg only) — 404 if the book's source isn't one of them. We don't proxy or cache the file ourselves, just point at the source.

Request
curl -I "http://localhost:8000/api/books/1651/download"
Response
HTTP/1.1 302 Found
Location: https://www.gutenberg.org/cache/epub/1661/pg1661.epub

Metadata sourced from Project Gutenberg and Open Library — public-domain/openly-licensed only. Rights concern: abuse@all.books.party