# Dynamic Links

The Google Books Dynamic Links feature allows you to create more customizable, reliable links to Google Books from your site. For example, this tool lets you generate "smart" links that appear only when a book is in our index, or display links that indicate to your users whether a book can be previewed on Google Books. The Dynamic Links feature also lets you include a thumbnail image in your link to Google Books. This document is intended to let you quickly add this functionality to your site.

*Note: This feature was formerly known as the the Book Viewability API.*

The [Preview Wizard](https://developers.google.com/books/docs/preview-wizard) is a tool built atop Dynamic Links that makes it even easier to link to book previews from site by just copying a few lines of code. This document is intended for more advanced developers looking to customize how they link to Book Search.

## Contents

1. [Audience](https://developers.google.com/books/docs/dynamic-links#audience)
2. [Book Search terminology](https://developers.google.com/books/docs/dynamic-links#terminology)
3. [Introduction](https://developers.google.com/books/docs/dynamic-links#introduction)
4. [Branding guidelines](https://developers.google.com/books/docs/dynamic-links#style-guide)
5. [The Client-side API](https://developers.google.com/books/docs/dynamic-links#clientSide)
6.
   1. [Request URL format](https://developers.google.com/books/docs/dynamic-links#requestFormat)
   2. [JSON results format](https://developers.google.com/books/docs/dynamic-links#JSONformat)
7. [Synchronous and asynchronous modes](https://developers.google.com/books/docs/dynamic-links#syncAsync)
8. [Frequently asked questions](https://developers.google.com/books/docs/dynamic-links#faq)
9. [Code samples](https://developers.google.com/books/docs/dynamic-links#htmlEx)

## Audience

The dynamic links documentation is intended for programmers who want to write web applications that link to books within Google Books. This documentation assumes that you are familiar with the HTTP protocol and basic JavaScript.

## Book Search terminology

Google Books respects the user's local copyright restrictions, and as a result, previews or full views of some books are not available in all locations. Viewability is clustered into the following classes:

Full View
:   The entire book is viewable. These books may be in the public domain.

Limited Preview
:   A portion of the book is viewable. This book is under copyright and Google Books has received permission to make these pages accessible to users. These books differ from Snippet View books in that users may view entire pages.

Snippet View and No Preview
:   Users see only an "About the book" page. At most, only short excerpts from the book are available. This book has either not been scanned, or is under copyright and Google Books has not received permission to expose more than a few "snippets" related to a user's search term.

## Introduction

The [Static Links](https://developers.google.com/books/docs/static-links) documentation describes a very simple way of generating URLs to a particular book's page on Google Books. Unfortunately, it is sometimes the case that a particular book is not in the Google Books index, or that a preview is not available to a user in a particular geographic location. Because Static Links are "blind," they sometimes fail to have the intended effect.

Dynamic Links provides an alternative, programmatic client-side method for querying the viewability of a book using JavaScript. This allows you to include more reliable and predictable links to Book Search, leading to a more consistent experience for your users. Because viewability varies according to the end user's location, the dynamic link interface is not designed for server-side or offline queries.

To get a sense of what Dynamic Links can do, skip to the [code samples](https://developers.google.com/books/docs/dynamic-links#htmlEx) at the end of this document.

## Branding guidelines

When rendering Dynamic Links, you must abide by the [branding guidelines](https://developers.google.com/books/branding) that govern the Google Books API Family. In particular,

- You must maintain attribution and links to Google Books.
- You must use only the approved [Google Preview button](https://developers.google.com/books/branding#previewbutton) when linking to previews on Google Books.
- Any text links, buttons, documentation, or descriptive text should abide by the approved [naming conventions](https://developers.google.com/books/branding#naming). For example, you should not use the verbs "download" or "read" when linking to Google Books previews, as only public domain works can be downloaded in their entirety.

<br />

### Example branding

![](https://books.google.com/books?id=LkQPOSXMUscC&pg=PP1&img=1&zoom=5&sig=ACfU3U0fC__U8FP9wTxmJfcP5ig0PURKeQ) **Freakonomics: An Rogue Economist Explores the Hidden Side of Everything**   
By Steven Levitt and Stephen Dubner   
[![](https://developers.google.com/static/books/images/gbs_preview_button1.gif)](https://books.google.com/books?id=LkQPOSXMUscC&printsec=frontcover)


The [samples section](https://developers.google.com/books/docs/dynamic-links#htmlEx) at the end of this document provides additional examples that are compliant with the current branding guidelines.

## Client-side API

At the core of the client-side dynamic link is a URL format that allows developers to construct URLs requesting information on one or more books and send the requests to Google Books using the `<script>` tag.

Syntax Example:
:   ` <script src="https://books.google.com/books?bibkeys=ISBN:0451526538&jscmd=viewapi&callback=mycallback"></script>`

### Request format

The format of the URL is similar to the URL syntax [used to link to books](https://books.google.com/support/bin/answer.py?answer=80658), but the book ID field may contain multiple comma separated book IDs and there are additional 'jscmd' and 'callback' parameters. Optionally, additional arguments can be present to control the viewability filters.

Dynamic Links supports several different methods for identifying books: ISBNs, OCLC numbers, and LCCN keys. The API allows batched queries of up to the size of the max size of a GET request.

ISBN
:   `&bibkeys=ISBN:0451526538` (The API supports both ISBN 10 and 13.)

OCLC
:   `&bibkeys=OCLC:36792831`

LCCN
:   `&bibkeys=LCCN:96072233`
:

<br />

### JSON results format

The response from this call will be information about the requested books returned as one or more JSON objects. The JSON objects use the following structure:

```
JsonSearchResult {
    string bib_key;
    string info_url;
    string preview_url;
    string thumbnail_url;
    string preview;
};
```

These fields provide the following information:

bib_key
:   The identifier used to query this book.

info_url
:   A URL to a page within Google Books with information on the book (the about this book page).

preview_url
:   A URL to the preview of the book, which takes the user directly to the cover of the book. If only Snippet View or No Preview books available for a request, no preview URL will be returned.

thumbnail_url
:   A URL to a thumbnail of the cover of the book.

preview
:   A value indicating the [viewability state](https://developers.google.com/books/docs/dynamic-links#terminology) of the book: `full` (for Full View books), `partial` (for Limited Preview books), or `noview` (for Snippet or No Preview books).

embeddable
:   This boolean is `true` if the book can be embedded onto third party pages using the Book Search [embedded viewer](https://developers.google.com/books/docs/viewer/developers_guide).