My favorites | English | Sign in

Google Book Search APIs (Labs)

Data API: Reference Guide

This document provides detailed reference documentation for the raw protocol (XML and HTTP) for the Google Book Search Data API.

This document doesn't contain information about the programming-language client libraries. For client-library reference information, see the links from the programming-language-specific sections of the developer's guide.

Contents

Audience

This document is intended for programmers who want to write client applications that can interact with Book Search.

It's a reference document; it assumes that you understand the concepts presented in the developer's guide, and the general ideas behind the Google Data APIs protocol.

Book Search feed types

Book Search provides a variety of representations of book-related data. This section describes the basic feed types and their URLs, all of which return one or more book results: the search feed, the Co-Branded Search feed, the single-item feed, the user library feed, and the user annotation feed.

Search feed

The search feed is a public read-only feed returned in response to a request to search for books. To retrieve search results, send a Data API request to the following URL:

http://books.google.com/books/feeds/volumes

Search requests can use any of the query paramaters defined in the query parameters reference section of this document. For example, the following URL requests all books related to the query "Elizabeth Bennet," starting with the 21st search and returning 10 results:

http://books.google.com/books/feeds/volumes?
  q=Elizabeth+Bennet
  &start-index=21
  &max-results=10

Additional information is available in the searching for books section of the developer's guide.

Partner Co-Branded Search feed

Content partners using Co-Branded Search can access a search result feed restricted to just their volumes by including the Co-Branded instance name in the feed URL:

http://books.google.com/books/feeds/p/PARTNER_COBRAND_ID/volumes?q=football+-soccer

For more information, see the Co-Branded Search section of the developer's guide.

Single item feed

As is standard with the Google Data APIs, it is possible to obtain information about a single volume using the single-item feed. The URL is:

http://www.google.com/books/feeds/volumes/VOLUME_ID

Here, VOLUME_ID represents the unique string Book Search has assigned to this volume (such as s1gVAAAAYAAJ). A link to the individual volume feed is provided via the <id> child of each entry in the other volume feeds. For more information on how feeds are related, see Navigating between feeds and resources.

User library feed

The user library feed is a read/write feed representing a list of books that a particular user has explicitly added to their My Library collection. On the Book Search website, a user can view and edit their library, and this list is also publicly visible to other Book Search users.

  • To request a feed of the authenticated user's library collection, send an HTTP GET request to the following URL. Note: For this request, you must provide an authentication token in the Authorization HTTP request header. The authentication token enables Book Search to identify the user.

    http://books.google.com/books/feeds/users/me/collections/library/volumes
    
  • To request a feed of another user's library, send an HTTP GET request to the following URL. Note that this request does not require authentication.

    http://books.google.com/books/feeds/users/USER_ID/collections/library/volumes
    

    In the URL above, replace USER_ID with the user's Book Search user identifier string (which appears, for example, as the uid parameter of that user's My Library page URL).

For more information on querying within a user's library, see the user library search section of the developer's guide.

User annotation feed

The user annotation feed is a read/write feed of a particular user's reviews, ratings, and labels for books. This content is presented in a number of ways on the Book Search site (such as on the About This Book page), and also as elements in the user's library feed.

  • To request a feed of the authenticated user's library annotations, send an HTTP GET request to the following URL. Note: For this request, you must provide an authentication token in the Authorization HTTP request header. The authentication token enables Book Search to identify the user.

    http://books.google.com/books/feeds/users/me/volumes
    
  • To request a feed of another user's annotations, send an HTTP GET request to the following URL. Note that this request does not require authentication.

    http://books.google.com/books/feeds/users/USER_ID/volumes
    

    In the URL above, replace USER_ID with the user's Book Search user identifier string (which appears, for example, as the uid parameter of that user's My Library page URL).

Every feed and entry contains <link rel="relationshipID"> elements that specify links to related feeds, entries, or resources. These elements enable you to obtain feed and resource URLs dynamically, without hardcoding the URLs into your application.

For example, the following <link> element, which might appear in a book entry, provides a link to a feed that contains a user's own ratings and reviews:

<link rel="http://schemas.google.com/books/2008/annotation"
  type="application/atom+xml"
  href="http://books.google.com/books/feeds/users/me/volumes"/>

Similarly, you can get a cover image for a book result using the URL provided by the thumbnail <link> element:

<link rel="http://schemas.google.com/books/2008/thumbnail"
  type="image/jpeg"
  href="http://bks7.books.google.com/books?id=aFbCdW8CcuAC&printsec=frontcover&img=1&zoom=5&sig=ACfU3U3ijgJlMlb3ztsN-H4Ka7HW7CSHfw&source=gbs_gdata"/>

The use cases in the developer's guide show how to use these elements to navigate from one feed or resource to another. In addition, the following diagram illustrates the interconnections between the various Book Search feeds and pages. Each solid arrow denotes a <link> element to another feed, and each dotted arrow denotes a <link> to an external resource such as a web page or a thumbnail image.

Feeds interconnection diagram

HTTP response codes for Book Search Data API requests

The following table describes some of the common HTTP status codes returned by the Book Search Data API. For additional response codes, see the relevant section of the Google Data APIs protocol.

Code Explanation
200 OK No error. The request to retrieve or update the resource, feed, or entity was successful.
201 CREATED Creation of a resource was successful.
400 BAD REQUEST Invalid request URI or header, or unsupported nonstandard parameter.
401 UNAUTHORIZED Authorization required. This may occur when a request did not contain an Authorization header, when the format of the Authorization header was invalid, or that the authentication token supplied in the header was invalid. See the Authentication section of the developer's guide.
403 FORBIDDEN Unsupported standard parameter, quota exceeded, or authentication or authorization failed.
404 NOT FOUND Resource (such as a feed or entry) not found.
500 INTERNAL SERVER ERROR Internal error. This is the default code that is used for all unrecognized errors.

When a Data API request fails, Book Search returns an HTTP 4xx or 5xx response code that generically identifies the failure as well as a plain text response that provides more specific information about the error(s) that caused the failure. The types of error you might encounter fall into a few categories:

  • Internal server error: typically a transient problem with our servers; please retry later. You can report issues to our API group and check for status updates on significant outages using our downtime notification group.
  • Unsupported ... request: look for a typo in the request or the XML entry that you submitted to the service.
  • The request exceeds the API quota on ... queries: you have reached your quota for that type of query for the time being; please retry in a few hours. If you believe the quota we set is too low for your application, please contact us.

Book Search query parameters reference

The Book Search Data API supports the following standard Google Data API query parameters:

Name Support
q Search feed, Co-Branded Search feed, User library feed, User annotation feed
start-index Search feed, Co-Branded Search feed, User library feed, User annotation feed
max-results Search feed, Co-Branded Search feed, User library feed, User annotation feed
start-index Search feed, Co-Branded Search feed, User library feed, User annotation feed
/-/category User library feed
category User library feed
alt Search feed, Co-Branded Search feed, User library feed, User annotation feed

For more information on querying the Book Search Data API, see the searching for books and user library search sections of the developer's guide.

Book Search does not support the updated-min, updated-max, published-min, or published-max parameters.

In addition to the standard Google Data API query parameters, the Book Search Data API supports the following parameters:

Name Description Notes
min-viewability Viewability filter
  • Restricts the search to just books that have the desired "viewability" level. For example, you can request only books that can be viewed in their entirety.
  • Acceptable values are none, partial, or full.
  • For more information, see <gbs:viewability>.

Book Search elements reference

In addition to the standard Data API elements, the Book Search Data API uses the following elements.

For information about the standard Google Data API elements, see the Atom specification and the Kinds document.

Atom elements reference

As a Google Data API, the Book Search Data API uses a number of elements defined by the Atom Publishing Protocol. These elements are in the atom namespace, which is the default namespace for elements described in this document.

Although these elements are documented in the general Google Data APIs Protocol Reference, the sections that follow provide further details about elements that have values or semantics specific to Book Search.

atom:category

The <category> element provides some classification for the current entry.

  • When the <category> element appears as a child of either <feed> or <entry>, it can identify the type of item described in each entry. The value of the scheme attribute is http://schemas.google.com/g/2005#kind and the value of the term attribute indicates whether the entries describe book volumes, thumbnail images, reviews, and so on.
  • Within user library and user annotation feeds, the <category> element also appears as a child of <entry> to specify any labels provided by the user for a particular book. In this case, the scheme attribute is http://schemas.google.com/books/2008/labels, indicating that the term attribute value is a user-provided label.

For more information on how various feeds and resources are linked, see the Navigating between feeds and resources section of this document.

Properties
Property Type Description
@scheme xsd:string

The scheme attribute specifies a URI that identifies the categorization scheme associated with the label.

  • When the <category> element is used to indicate the type of item described by entries, this attribute's value is http://schemas.google.com/g/2005#kind.
  • When the <category> element is used to indicate a user-entered label for an entry—such as in a User library feed—this attribute's value is http://schemas.google.com/books/2008/labels.
@term xsd:string The term identifies the type of entity contained in an entry, or else a user-entered label associated with a book.
Examples
<category scheme="http://schemas.google.com/g/2005#kind"
  term="http://schemas.google.com/books/2008#volume"/>
<category scheme="http://schemas.google.com/books/2008/labels" term="ForLydia"/>
Schema
namespace atom = "http://www.w3.org/2005/Atom"
start = books_booksCategory

books_booksCategory =
  element atom:category {
    attribute label { xsd:string }?,
    attribute scheme {
      "http://schemas.google.com/books/2008/labels" |
      "http://schemas.google.com/g/2005#kind" },
    attribute term { xsd:string }
  }

The <link> element contains an IRI reference that's relevant to a feed or an entry. Example references pointed to by this element include reviews, thumbnail images, preview URLs, and adjacent search result pages. These elements enable you to obtain feed and resource URLs dynamically, without hardcoding the URLs into your application. For more information, see the Navigating between feeds and resources section of this document.

This element appears as a child of <feed> and <entry>. There may be multiple <link> children per element.

Properties
Property Type Description
@rel xsd:string

The rel attribute indicates how the URI specified in the href attribute is related to the current result set. Specifically,

  • self: The link identifies the URL that you would use to retrieve information about the feed or a particular entry in the feed. If this relation appears on a feed that is the result of performing a query, then this URI includes the same query parameters (or at least querying this URI produces the same result as querying with those parameters).

  • edit: The link identifies the URL that you would use to modify an entry.

  • prev: The link points to the previous page of the feed's result set.

  • next: The link points to the next page of the feed's result set.

  • http://schemas.google.com/books/2008/info: The link points to to a description page for the volume.

  • http://schemas.google.com/books/2008/preview: The link points to a page where the book can be previewed (or, if the book has "full" viewability, where the book can be read in its entirety).

  • http://schemas.google.com/books/2008/thumbnail: The link points to a thumbnail image representing the book.

  • http://schemas.google.com/books/2008/annotation: The link points to the user's annotation feed.

  • http://schemas.google.com/g/2005#batch: The link points to the URI that can be used to batch operations to query, insert, update, and delete entries on this feed. (This relation does not exist if the feed is read-only or if batching not enabled on this feed.)

  • http://schemas.google.com/g/2005#post: The link points to the URI that can be used to post new entries to the feed. (This relation does not exist if the feed is read-only.)

The rel attribute may also contain a link to a schema that identifies the type of entity related to the corresponding link. For example, a book entry may contain <link> elements that point to reviews, related volumes, and related web pages for that book. Some of these <link> elements can be used to retrieve additional feeds, such as related books and reviews, while others can be used to post data, such as a rating.

@type xsd:string The type attribute specifies the media type of the resource at the associated URL. The links in a Book Search Data API response typically refer to an HTML page, an image, or another Data API response (Atom feed). Thus, the most common values for the type attribute are text/html, image/jpeg, and application/atom+xml.
@href xsd:string The href attribute specifies a URI that identifies the resource identified in the <link> element.
Examples
<link rel="http://schemas.google.com/books/2008/thumbnail" type="image/jpeg"
  href="http://bks3.books.google.com/books?id=o9dyGQAACAAJ&printsec=frontcover&img=1&zoom=5&sig=ACfU3U2sYY4y7XFmHKMYvISqfVGKwdN93w&source=gbs_gdata"/>
<link rel="http://schemas.google.com/books/2008/info" type="text/html"
  href="http://books.google.com/books?id=o9dyGQAACAAJ&dq=pride+and+prejudice&ie=ISO-8859-1&source=gbs_gdata"/>
<link rel="http://schemas.google.com/books/2008/preview" type="text/html"
  href="http://books.google.com/books?id=o9dyGQAACAAJ&dq=pride+and+prejudice&ie=ISO-8859-1&source=gbs_gdata"/>
<link rel="alternate" type="text/html"
  href="http://books.google.com/books?id=o9dyGQAACAAJ&dq=pride+and+prejudice&ie=ISO-8859-1"/>
<link rel="self" type="application/atom+xml"
  href="http://www.google.com/books/feeds/volumes/o9dyGQAACAAJ"/>
Schema
namespace atom = "http://www.w3.org/2005/Atom"
start = books_booksLink

books_booksLink =
  element atom:link {
    attribute href { xsd:string },
    attribute rel {
      "edit" |
      "http://schemas.google.com/books/2008/info" |
      "http://schemas.google.com/books/2008/preview" |
      "http://schemas.google.com/books/2008/thumbnail" |
      "http://schemas.google.com/books/2008/annotation" |
      "http://schemas.google.com/g/2005#batch" |
      "http://schemas.google.com/g/2005#post" |
      "next" |
      "previous" |
      "self" },
    attribute title { xsd:string }?,
    attribute type {
      "application/atom+xml" |
      "image/jpeg" |
      "image/png" |
      "text/html" }
  }

OpenSearch elements reference

Book Search uses OpenSearch elements to augment the feed with the information necessary to render paginated search results. The schema URL for the openSearch namespace is http://a9.com/-/spec/opensearchrss/1.0.

Book Search uses the standard OpenSearch elements in the standard way, so for reference information about those elements, see the OpenSearch specification.

Dublin Core elements reference

The Book Search Data API uses the Dublin Core Metadata Element Set under the dc namespace to provide standard information about each book entry. The Dublin Core Metadata Element Set is a vocabulary of fifteen properties for use in describing resources such as books. The schema URL for the dc namespace is http://purl.org/dc/elements/1.1/.

dc:creator

The <dc:creator> element identifies an author—or more generally, an entity responsible for creating the volume in question. Examples of a creator include a person, an organization, or a service. In the case of anthologies, proceedings, or other edited works, this field may be used to indicate editors or other entities responsible for collecting the volume's contents.

This element appears as a child of <entry>. If there are multiple authors or contributors to the book, there may be multiple <dc:creator> elements in the volume entry (one for each creator or contributor).

Properties
Property Type Description
text() xsd:string The name of an author, creator, or contributor to this book.
Example
<dc:creator>Jane Austen</dc:creator>
Schema
namespace dc = "http://purl.org/dc/terms"
start = dublincore_creator

dublincore_creator =
  element dc:creator {
    xsd:string
  }

dc:date

The <dc:date> element indicates the publication date of the specific volume in question. If the book is a reprint, this is the reprint date, not the original publication date. The date is encoded according to the ISO-8601 standard (and more specifically, the W3CDTF profile).

The <dc:date> element can appear only as a child of <entry>.

Properties
Property Type Description
text() xsd:string An ISO-8601-formatted publication date.
Example
<dc:date>1813-01-28</dc:date>
Schema
namespace dc = "http://purl.org/dc/terms"
start = dublincore_date

dublincore_date =
  element dc:date {
    xsd:string
  }

dc:description

The <dc:description> element includes text that describes a book or book result. In a search result feed, this may be a search result "snippet" that contains the words around the user's search term. For a single volume feed, this element may contain a synopsis of the book.

The <dc:description> element can appear only as a child of <entry>.

Properties
Property Type Description
text() xsd:string The description of the volume.
Example
<dc:description>Austen's comedy of manners--one of the most popular novels
of all time--features splendidly civilized sparring between the proud Mr...</dc:description>
Schema
namespace dc = "http://purl.org/dc/terms"
start = dublincore_description

dublincore_description =
  element dc:description {
    xsd:string
  }

dc:format

The <dc:format> element describes the physical properties of the volume. Currently, it indicates the number of pages in the book, but more information may be added to this field in the future.

This element can appear only as a child of <entry>.

Properties
Property Type Description
text() xsd:string A string describing physical properties of this book.
Example
<dc:format>95 pages</dc:format>
Schema
namespace dc = "http://purl.org/dc/terms"
start = dublincore_format

dublincore_format =
  element dc:format {
    xsd:string
  }

dc:identifier

The <dc:identifier> element provides an unambiguous reference to a particular book.

  • Every <entry> contains at least one <dc:identifier> child.
  • The first identifier is always the unique string Book Search has assigned to the volume (such as s1gVAAAAYAAJ). This is the ID that appears in the book's URL in the Book Search GUI, as well as in the URL of that book's single item feed.
  • Many books contain additional <dc:identifier> elements. These provide alternate, external identifiers to the volume. Such identifiers may include the ISBNs, ISSNs, Library of Congress Control Numbers (LCCNs), and OCLC numbers; they are prepended with a corresponding namespace prefix (such as "ISBN:").
  • Any <dc:identifier> can be passed to the Dynamic Links, used to instantiate an Embedded Viewer, or even used to construct static links to Book Search.

The <dc:identifier> element can appear only as a child of <entry>.

Properties
Property Type Description
text() xsd:string A unique identifier string for this volume.
Examples
<dc:identifier>qCkfAAAACAAJ</dc:identifier>
<dc:identifier>ISBN:0582780934</dc:identifier>
Schema
namespace dc = "http://purl.org/dc/terms"
start = dublincore_identifier

dublincore_identifier =
  element dc:identifier {
    xsd:string
  }

dc:publisher

The <dc:publisher> element contains the name of the entity responsible for producing and distributing the volume (usually the specific edition of this book). Examples of a publisher include a person, an organization, or a service.

This element can appear only as a child of <entry>. If there is more than one publisher, multiple <dc:publisher> elements may appear.

Properties
Property Type Description
text() xsd:string The name of the publisher.
Example
<dc:publisher>T. Egerton of the Whitehall Military Library</dc:publisher>
Schema
namespace dc = "http://purl.org/dc/terms"
start = dublincore_publisher

dublincore_publisher =
  element dc:publisher {
    xsd:string
  }

dc:subject

The <dc:subject> element identifies the topic of the book. Usually this is a Library of Congress Subject Heading (LCSH) or Book Industry Standards and Communications Subject Heading (BISAC).

The <dc:subject> element can appear only as a child of <entry>. There may be multiple <dc:subject> elements per entry.

Properties
Property Type Description
text() xsd:string A subject for this book according to some classification scheme.
Example
<dc:subject>Fiction</dc:subject>
Schema
namespace dc = "http://purl.org/dc/terms"
start = dublincore_subject

dublincore_subject =
  element dc:subject {
    xsd:string
  }

dc:title

The <dc:title> element contains the title of a book as it was published. If a book has a subtitle, it appears as a second <dc:title> element in the book result's <entry>.

Properties
Property Type Description
text() xsd:string A title or subtitle of a volume.
Example
<dc:title>Pride and Prejudice</dc:title>
<dc:title>A Novel</dc:title>
Schema
namespace dc = "http://purl.org/dc/terms"
start = dublincore_title

dublincore_title =
  element dc:title {
    xsd:string
  }

Book Search custom elements reference

Book Search provides a custom element namespace, gbs, for use in the various volume and reviews feeds. The schema URL for the gbs namespace is http://schemas.google.com/books/2008.

gbs:viewability

Google Book Search respects the user's local copyright restrictions. As a result, previews or full views of some books are not available in all locations. The <gbs:viewability> element indicates whether a book is fully viewable, can be previewed, or only has "about the book" information. These three "viewability modes" are the same ones returned by the Dynamic Links API.

Note: The viewability mode for a given book varies according to the end user's location. To ensure your users get accurate and consistent results, we recommend that you include the end-user IP address in every query to the Book Search Data API. For more information, see the Setting user location section in the developer's guide.

The <gbs:viewability> element can appear only as a child of <entry>.

Properties
Property Type Description
@value? xsd:string

A programmatic value representing the book's "viewability" mode.

  • Full View books: http://schemas.google.com/books/2008#view_all_pages. This value indicates that the entire book can be viewed. This book may be in the public domain.
  • Limited Preview books: http://schemas.google.com/books/2008#view_partial. Indicates that a limited preview of the book is available. This book is under copyright and Google Book Search has received permission to make these pages accessible to users. Books with this mode differ from Snippet View books in that users may view entire pages.
  • Snippet View and No Preview books: http://schemas.google.com/books/2008#view_no_pages. 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 Book Search has not received permission to expose more than a few "snippets" related to a user's search term.
  • http://schemas.google.com/books/2008#view_unknown: The viewability status for this book could not be determined.
Example
<gbs:viewability value="http://schemas.google.com/books/2008#view_all_pages"/>
Schema
namespace gbs = "http://schemas.google.com/books/2008"
start = books_viewability

books_viewability =
  element gbs:viewability {
    attribute value { xsd:string }?
  }

gbs:embeddability

Many of the books found on Google Book Search can be embedded on third-party sites using the Embedded Viewer. The <gbs:embeddability> element indicates whether a particular book result is available for embedding. By definition, a book that cannot be previewed on Book Search cannot be embedded on third-party sites.

Note: Some books cannot be accessed by users in certain countries. To ensure you only embed books that are available to your end users, we recommend that you include the end-user IP address in every query to the Book Search Data API. For more information, see the Setting user location section in the developer's guide.

The <gbs:embeddability> element can appear only as a child of <entry>.

Properties
Property Type Description
@value? xsd:string

A programmatic value representing the book's embeddability.

  • http://schemas.google.com/books/2008#embeddable: The book is available for embedding on third-party sites.
  • http://schemas.google.com/books/2008#not_embeddable: The book cannot be embedded on third-party sites.
Example
<gbs:embeddability value="http://schemas.google.com/books/2008#embeddable"/>
Schema
namespace gbs = "http://schemas.google.com/books/2008"
start = books_embeddability

books_embeddability =
  element gbs:embeddability {
    attribute value { xsd:string }?
  }

gbs:review

When present, the <gbs:review> element contains a user-generated review for a given book. This element currently appears only in the user library and user annotation feeds, as a child of <entry>.

Properties
Property Type Description
text() xsd:string Text content of the review.
@type? xsd:string Type of text construct (typically text, html, or xhtml).
@xml:lang? xsd:string Automatically-identified language of the review. May be incorrect.
Example
<gbs:review type="text" xml:lang="en">A great beach read!</gbs:review>
Schema
namespace gbs = "http://schemas.google.com/books/2008"
namespace xml = "http://www.w3.org/XML/1998/namespace"
start = books_review

books_review =
  element gbs:review {
    attribute type { xsd:string }?,
    attribute xml:lang { xsd:string }?,
    xsd:string
  }

Further resources

You may find the following documents useful:

Back to top