ISBNLab API Client Libraries
Official, open-source clients for the ISBNLab API in PHP, Python, TypeScript/JavaScript and Go. Each one has a method for every endpoint and returns typed objects, so looking up a book by ISBN takes a few lines.
ISBNLab on GitHub Get a Free API KeyPHP
Install
composer require isbnlab/isbnlab-php
Look up a book
$config = ISBNLab\Configuration::getDefaultConfiguration()
->setAccessToken(getenv('ISBNLAB_API_TOKEN'));
$books = new ISBNLab\Api\BooksApi(new GuzzleHttp\Client(), $config);
$book = $books->getBookByIsbn('9780765302304');
echo $book->getTitle(); // The Gathering Storm
echo $book->getAuthors()[0]->getName(); // Robert Jordan
Python
Install
pip install isbnlab
Look up a book
import os
import isbnlab
config = isbnlab.Configuration(access_token=os.environ["ISBNLAB_API_TOKEN"])
with isbnlab.ApiClient(config) as client:
book = isbnlab.BooksApi(client).get_book_by_isbn("9780765302304")
print(book.title) # The Gathering Storm
print(book.authors[0].name) # Robert Jordan
TypeScript and JavaScript
Install
npm install isbnlab
Look up a book
import { BooksApi, Configuration } from 'isbnlab';
const books = new BooksApi(new Configuration({ accessToken: process.env.ISBNLAB_API_TOKEN }));
const book = await books.getBookByIsbn('9780765302304');
console.log(book.title); // The Gathering Storm
console.log(book.authors?.[0]?.name); // Robert Jordan
Go
Install
go get github.com/isbnlab/isbnlab-go
Look up a book
client := isbnlab.NewAPIClient(isbnlab.NewConfiguration())
ctx := context.WithValue(context.Background(), isbnlab.ContextAccessToken, os.Getenv("ISBNLAB_API_TOKEN"))
book, _, err := client.BooksAPI.GetBookByIsbn(ctx, "9780765302304").Execute()
if err != nil {
log.Fatal(err)
}
fmt.Println(book.GetTitle(), "by", book.GetAuthors()[0].GetName())
Getting started
- Create a free account and copy your API token. The Free plan includes book lookups and the ISBN tools; covers and author, publisher, subject and genre lookups need a Standard plan, and search and other editions a Pro plan. See pricing.
- Keep the token on your server, in an environment variable such as
ISBNLAB_API_TOKEN. A token in browser code can be read by anyone who opens the page. - Every library follows the same API documentation, which describes each field and status code.
More on GitHub
- Symfony example app: book pages, ISBN conversion, author lookups and error handling, built on the PHP client.
- ONIX reader for PHP: reads ONIX for Books 2.1, 3.0 and 3.1 files, however large.
- Another language? Generate a client from the OpenAPI specification, or tell us which one you need.