Using the Book Search Data APIThe Google Book Search Data API allows client applications to view and update Book Search content in the form of Google Data API feeds. Your client application can use the Book Search Data API to issue full-text searches for books and to retrieve standard book information, ratings, and reviews. You can also access individual users' » library collections and public reviews. Finally, your application can submit authenticated requests to enable users to create and modify library collections, ratings, labels, reviews, and other account-specific entities. For more information on the Book Search Data API, please refer to the official » PHP Developer's Guide on code.google.com. Authenticating to the Book Search serviceYou can access both public and private feeds using the Book Search Data API. Public feeds don't require any authentication, but they are read-only. If you want to modify user libraries, submit reviews or ratings, or add labels, then your client needs to authenticate before requesting private feeds. It can authenticate using either of two approaches: AuthSub proxy authentication or ClientLogin username/password authentication. Please refer to the » Authentication section in the PHP Developer's Guide for more detail. Searching for booksThe Book Search Data API provides a number of feeds that list collections of books.
The most common action is to retrieve a list of books that match a
search query. To do so you create a
For example, to perform a keyword query, with a filter on
viewability to restrict the results to partial or full view books, use
the
The
Note: Since Book Search results are public, you can issue a Book Search query without authentication.
Here are some of the most common
Partner Co-Branded SearchGoogle Book Search provides » Co-Branded Search, which lets content partners provide full-text search of their books from their own websites. If you are a partner who wants to do Co-Branded Search using the Book Search Data API, you may do so by modifying the feed URL above to point to your Co-Branded Search implementation. If, for example, a Co-Branded Search is available at the following URL:
then you can obtain the same results using the Book Search Data API at the following URL:
To specify an alternate URL when querying a volume feed, you can
provide an extra parameter to
For additional information or support, visit our » Partner help center. Using community featuresAdding a ratingA user can add a rating to a book. Book Search uses a 1-5 rating system in which 1 is the lowest rating. Users cannot update or delete ratings.
To add a rating, add a
ReviewsIn addition to ratings, authenticated users can submit reviews or edit their reviews. For information on how to request previously submitted reviews, see » Retrieving annotations. Adding a review
To add a review, add a
Editing a reviewTo update an existing review, first you retrieve the review you want to update, then you modify it, and then you submit it to the annotation feed.
LabelsYou can use the Book Search Data API to label volumes with keywords. A user can submit, retrieve and modify labels. See » Retrieving annotations for how to read previously submitted labels. Submitting a set of labels
To submit labels, add a
Retrieving annotations: reviews, ratings, and labels
You can use the Book Search Data API to retrieve annotations
submitted by a given user. Annotations include reviews, ratings, and
labels. To retrieve any user's annotations, you can send an
unauthenticated request that includes the user's user ID. To retrieve the
authenticated user's annotations, use the value
For a list of the supported query parameters, see the » query parameters section. Deleting Annotations
If you retrieved an annotation entry containing ratings,
reviews, and/or labels, you can remove all annotations
by calling
Book collections and My LibraryGoogle Book Search provides a number of user-specific book collections, each of which has its own feed. The most important collection is the user's My Library, which represents the books the user would like to remember, organize, and share with others. This is the collection the user sees when accessing his or her » My Library page. Retrieving books in a user's libraryThe following sections describe how to retrieve a list of books from a user's library, with or without query parameters. You can query a Book Search public feed without authentication. Retrieving all books in a user's library
To retrieve the user's books, send a query to the
My Library feed. To get the library of the authenticated
user, use
Note: The feed may not contain all of the user's books, because
there's a default limit on the number of results returned. For
more information, see the Searching for books in a user's library
Just as you can » search across all books,
you can do a full-text search over just the books in a
user's library. To do this, just set the appropriate
paramters on the For example, the following query returns all the books in your library that contain the word "bear":
For a list of the supported query parameters, see the » query parameters section. In addition, you can search for books that have been » labeled by the user:
Updating books in a user's libraryYou can use the Book Search Data API to add a book to, or remove a book from, a user's library. Ratings, reviews, and labels are valid across all the collections of a user, and are thus edited using the annotation feed (see » Using community features). Adding a book to a libraryAfter authenticating, you can add books to the current user's library. You can either create an entry from scratch if you know the volume ID, or insert an entry read from any feed. The following example creates a new entry and adds it to the library:
The following example adds an existing
Removing a book from a library
To remove a book from a user's library, call
|
|