Read API demo

This is a simple demo of the Open Library Read API. See the page code for how it works. It demonstrates how use a helper script to add links to readable Open Library books.

Sample books

Below is a table of books and library identifiers. In the third column are (empty) html <div> elements, like this:

<div class="ol_readapi_book" isbn="0914845462">
Title Identifiers Open Library Result
The Log of a Cowboy - Andy Adams, 1903 lccn:03012817 oclc:03544699
The Montessori Method - Maria Montessori, 1912 oclc:1181252
Little Wars - H. G. Wells, 1913 olid:OL7142194M
This Side of Paradise - F. Scott Fitzgerald, 1920 lccn:20006430 oclc:2340134
For Victory in Peaceful Competition with Capitalism - Nikita Khrushchev, 1960 lccn:60006004
The Media Lab: Inventing the Future at M.I.T. - Stewart Brand, 1988 oclc:17618551
Confessions of an Economic Hitman - John Perkins, 2004 isbn:9781576755129
A Romance on Three Legs - Katie Hafner, 2009 olid:OL24218576M
In Library books below - available to partner libraries
The Great Gatsby - F. Scott Fitzgerald, 1925 lccn:58014791
James and the Giant Peach - Roald Dahl, 1961 isbn:0140328718 oclc:429574805
Catch-22 - Joseph Heller, 1961 oclc:19602226
Of Mice and Men - John Steinbeck, 1967 ed. oclc:17523982
Fahrenheit 451 - Ray Bradbury, 1953 lccn:53011280
Anecdotes of Destiny - Isak Dinesen, 1974 ed. (In Library only) isbn:0394711777
Lolita - Valdimir Nabokov, 1989 ed. lccn:88040511
Into Thin Air - Jon Krakauer, 1997 isbn:0679457526
The Moor's Last Sigh - Salman Rushdie, 1997 isbn:0679744665

Calling the script

When the helper script loads, it searches through the document for any "ol_readapi_book" <div> books, collects identifiers from them, and makes a call to the Read API to check Open Library for readable links. When this returns, it creates read links for any books it has found.