Advertising sustains the DA. Ads are hidden for members. Join today

Third-party Integration Modules

Goodreads

Goodreads, a social networking site for book readers, claims to be the largest site for book recommendations in the world. As of 2016, Goodreads had 55 million members who added more than 1.5 billion books to their "shelves".€ The book data itself comes from a variety of sources, including Amazon, Barnes & Noble, Ingram, Library of Congress, WorldCat, and others alongside data submitted by individual publishers and Goodreads users.

The Goodreads module, along with its bundled submodules, lets you integrate Goodreads data into your Drupal website.

Goodreads book reviews are the most popular features for integration into Drupal websites. Goodreads recently changed how those reviews are displayed, replacing the XML review text with an iFrame display of reviews for a given book (presumably to protect their intellectual property). Single reviews can still be accessed via the API, although it is relatively complex. In theory, with special permissions, the older XML versions of the reviews can be accessed, but that is outside the scope of the Goodreads module at this time.

In addition to displaying reviews and associated book data, the Goodreads API allows you to organize a user’s books onto user-defined bookshelves, create and edit reviews, and see the connections between various editions, called works by Goodreads, alongside their linkages to authors and book series.

Beyond book data and reviews, Goodreads is first and foremost a community, so it has the usual social networking functions. You can request to be a friend, you can follow someone’s reviews and status updates, you can join groups and post messages on them (much like Drupal’s forums), and you can comment on virtually anything. The Goodreads API can support all of this social interaction.

The Goodreads module, with its submodules, implements most of the Goodreads API. The only parts of the API not implemented are those calls that require additional permissions beyond what you can get by signing up as a developer. In addition, there are a few API calls that don’t work, mostly due to known bugs that hopefully will get fixed in the near future. Of the 56 documented Goodreads APIs, the base Goodreads module exposes 27 APIs and the OAuth module adds 26. 4 APIs have unresolved issues, and another 4 require extra permissions and are therefore not implemented. The numbers don’t add up because some APIs have OAuth options, resulting in two PHP interface functions. The non-functioning APIs are included in the other categories.

The Goodreads module itself is mostly an API support module. It provides the user interface needed to enter your Goodreads developer key information. It also provides caching for the non-OAuth, which could be a requirement to stay within the Goodreads API call limits.

The Goodreads Filter module exposes Goodreads data to your Drupal content via a new input filter that adds tokens like [goodreads_get_isbn_reviews title 1430209895] to insert the title of a book with ISBN 1430209895 into your content. Using a somewhat unusual notation, this module lets you access virtually anything in the Goodreads API. Additionally, it is theoretically possible to use the OAuth module’s functions to change things on Goodreads using the filter, although doing so is highly discouraged!

The Goodreads Views module stores information about each user’s Goodreads bookshelves in a table in your Drupal database and makes that information available via the Views module. The data is rebuilt via cron at a configurable time each day using the Drupal Queue module to avoid overloading your cron job. Depending on the number of Goodreads users, and the number of books on their shelves, you may need several cron runs a day to keep the table up to date.

The Goodreads OAuth module adds support for using the OAuth module’s libraries to enable access to those Goodreads APIs which require OAuth authorization to utilize a user’s information. It adds additional API functions and extends the other submodules to expose additional data to your Drupal content. In addition, if you want to change anything on the Goodreads side, you will need the Goodreads OAuth module.

We'd like to thank the developers of the Amazon module for the inspiration on how to expose Goodreads data to Drupal. Because a lot of Goodreads book data comes from Amazon, and Amazon puts restrictions on the redistribution of its data, Goodreads doesn’t always supply all the information that is displayed on their site via the API. You may find you need the Amazon module to directly access that data from Amazon.

This module was developed for Columbus Metropolitan Library. The use case for Columbus Metropolitan Library uses just a fraction of the Goodreads API exposed by the module. I expect that as more people use the module, we’ll find lots of areas for improvement.

Goodreads API functions sorted by PHP function name

The Goodreads module, and its OAuth submodule, expose the Goodreads API via the following PHP functions that can be called from custom

Goodreads API list with corresponding PHP functions

This list of Goodreads APIs is in the same order as the list on the Goodreads API page. Below each Goodreads API name, which is a link to

Goodreads Filter Submodule

This submodule exposes the data from the Goodreads module (and optionally the Goodreads OAuth module) to Drupal via an input filter.

Goodreads Module

Alone, the main Goodreads module is not going to be useful to a Drupal site builder that cannot program in PHP. While it has a

Goodreads OAuth Submodule

This submodule implements additional Goodreads API calls that require OAuth to access a specific Goodreads user’s information.

Goodreads Views Submodule

This submodule implements a common use case of Goodreads data integration using Views. Once a day during a cron job, the books on every

Guide maintainers

greggmarshall's picture