A site for readers and writers that's been around since 2007, Goodreads, now owned by Amazon, lets users track books, rate and review them, network with readers and search the site's extensive database. It's a social network in addition to being a personal book tracking system. The week this site first went live (5/17/2016), Goodreads Deals was launched, e-mailing users whenever ebooks get discounted. As a thriving community for book lovers, it offers the developer a warehouse of book data to call upon, and on this site, we'll only be dipping our toe into what available through the Goodreads API. So first, please feel free check out the Goodreads site! Create an account -- it's easy and can be done in seconds via the button below.
Before we start, let's talk briefly about CORS, or "cross-origin resource sharing." It's a security system in place on most web browsers that prevents some web data from being exchanged across different domains. That is, we are blocked from getting our book data from Goodreads (or most APIs) from outside the Goodreads domain itself. For the purposes of this tutorial, please use Chrome to view the examples, and click the link below if you haven't already, to install a free plug-in that allows this security feature to be temporarily bypassed. All of the examples on the site function as designed, so if you're having a problem with them responding, please make sure you're in Chrome, and have this feature installed and turned on! Thank you, and let's get to the fun!
The objective of this tutorial is to leverage the incredible pool of information that Goodreads has amassed and made available for free to developers. More specifically, we're going to focus on a client-side access of the Goodreads API to make our own book search engine, allowing a user to search by title, author, or all, and returning results from Goodreads that include the average user review for each book. We'll also look at some possible server-side code and cover a variety of topics central to this process -- like handling data in the format the Goodreads API sends it back to you.
Before we go further, let's talk about what an API even is. Click the link below for this, or, if you're comfortable with APIs, feel free to jump ahead using the navigation above.