All Projects → baahrens → Goodreads Api Node

baahrens / Goodreads Api Node

Licence: mit
Goodreads API wrapper for node.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Goodreads Api Node

Taxize
A taxonomic toolbelt for R
Stars: ✭ 209 (+190.28%)
Mutual labels:  api, api-wrapper
Yahooquery
Python wrapper for an unofficial Yahoo Finance API
Stars: ✭ 288 (+300%)
Mutual labels:  api, api-wrapper
Hubspot Php
HubSpot PHP API Client
Stars: ✭ 273 (+279.17%)
Mutual labels:  api, api-wrapper
Riot Api Java
Riot Games API Java Library
Stars: ✭ 184 (+155.56%)
Mutual labels:  api, api-wrapper
Pizzly
The simplest, fastest way to integrate your app with an OAuth API 😋
Stars: ✭ 796 (+1005.56%)
Mutual labels:  api, api-wrapper
Virustotal Api
Virus Total Public/Private/Intel API
Stars: ✭ 189 (+162.5%)
Mutual labels:  api, api-wrapper
Crawlertutorial
爬蟲極簡教學(fetch, parse, search, multiprocessing, API)- PTT 為例
Stars: ✭ 282 (+291.67%)
Mutual labels:  api, api-wrapper
Rcrossref
R client for various CrossRef APIs
Stars: ✭ 137 (+90.28%)
Mutual labels:  api, api-wrapper
Rapid.js
An ORM-like Interface and a Router For Your API Requests
Stars: ✭ 700 (+872.22%)
Mutual labels:  api, api-wrapper
Python Poloniex
Poloniex API wrapper for Python 2.7 & 3
Stars: ✭ 557 (+673.61%)
Mutual labels:  api, api-wrapper
Graphql2rest
GraphQL to REST converter: automatically generate a RESTful API from your existing GraphQL API
Stars: ✭ 181 (+151.39%)
Mutual labels:  api, api-wrapper
Apipie
Transform api declaration to js object for frontend. Inspired by VueRouter, koa-middleware and axios.
Stars: ✭ 29 (-59.72%)
Mutual labels:  api, api-wrapper
Coingecko Api
A Node.js wrapper for the CoinGecko API with no dependencies.
Stars: ✭ 159 (+120.83%)
Mutual labels:  api, api-wrapper
Binance
A .NET Standard Binance API library.
Stars: ✭ 199 (+176.39%)
Mutual labels:  api, api-wrapper
Jda
Java wrapper for the popular chat & VOIP service: Discord https://discord.com
Stars: ✭ 2,598 (+3508.33%)
Mutual labels:  api, api-wrapper
Pycoingecko
Python wrapper for the CoinGecko API
Stars: ✭ 270 (+275%)
Mutual labels:  api, api-wrapper
Bittrex.net
A C# .Net wrapper for the Bittrex web API including all features easily accessible and usable
Stars: ✭ 131 (+81.94%)
Mutual labels:  api, api-wrapper
Mlb Statsapi
Python wrapper for MLB Stats API
Stars: ✭ 135 (+87.5%)
Mutual labels:  api, api-wrapper
V8 Archive
Directus Database API — Wraps Custom SQL Databases with a REST/GraphQL API
Stars: ✭ 486 (+575%)
Mutual labels:  api, api-wrapper
Slack
🎉✨ Slack API client for Node and browsers.
Stars: ✭ 903 (+1154.17%)
Mutual labels:  api, api-wrapper

A Goodreads API wrapper for node.js

Goodreads

Installation

npm install --save goodreads-api-node
const goodreads = require('goodreads-api-node');

Usage

You need to register your app to get a goodreads developer key With the developer key and secret you can now call goodreads(). This will return an object which exposes the API methods.

const myCredentials = {
  key: 'MY_GOODREADS_KEY',
  secret: 'MY_GOODREADS_SECRET'
};

const gr = goodreads(myCredentials);

API

Some of those API methods just need your key/secret. To make API calls on behalf of your user, you need to get their permission using oAuth. All methods on the goodreads object return an promise. The following methods all work without oAuth:

getBooksByAuthor(authorID, [page])

// returns all books by an author given the authorID
gr.getBooksByAuthor('175417')
.then(console.log);

This prints the following result:

 { id: '175417',
   name: 'Bruce Schneier',
   link: 'https://www.goodreads.com/author/show/175417.Bruce_Schneier',
   books: { start: '1', end: '25', total: '25', book: [Object] }
 }

You can pass an optional page parameter specifying the result page you want to get.

getAuthorInfo(authorID)
getAllSeriesByAuthor(authorID)
getUserInfo(userID)
getUsersShelves(userID)
getUsersGroups(userID, [sort])
getGroupMembers(groupID, [params])
searchGroups(query, [page])
getGroupInfo(groupID, [params])
getRecentReviews()
getReview(reviewID, [page])
getUsersReviewForBook(userID, bookID)
getRecentStatuses()
showBook(bookID)
bookIDtoWorkID(bookId)
getSeries(seriesID)
getSeriesByWork(workID)

searchBooks([params]);

@param {object} params q: query, page: page of results, field: one of 'title', 'author' or 'all' (default)

Example Usage:

  const res = await goodreads.searchBooks( { q: 'A song of ice and fire', page: 2, field: 'title' } );

OAuth authentication and methods

If you want to make requests on behalf of your user (e.g. them marking a book as 'read') you need to get their permission. The Goodreads API uses OAuth for this.

There are two ways to initialize the oauth process. You can either pass a callbackURL to the goodreads() function (which then calls initOAuth() for you) or you just call gr.initOAuth() after setting up your credentials. The callbackURL is not required for oauth to work, it's just used for goodreads to be able to redirect your user after granting/denying access.

// set callbackURL together with your key/secret
const gr = goodreads(myCredentials, callbackURL);

// or call initOAuth(callbackURL) after setting up your key/secret
const gr = goodreads(myCredentials)
gr.initOAuth(callbackURL);

After this you should be able to call getRequestToken() to obtain a requestToken. You need the requestToken to inform your user about your app wanting to make requests with his account.

gr.getRequestToken()
.then(url => { /* redirect your user to this url to ask for permission */ });

getRequestToken() returns (a promise which resolves) a URL. You can now redirect your user to this URL to ask him for access to his account. The callbackURL provided in initOAuth() is then used to inform you about whether the user granted access. Goodreads will redirect to this url with the query params oauth_token and authorize.

http://yourapp.com/goodreads_oauth_callback?oauth_token=ezBHZc7C1SwvLGc646PEQ&authorize=1

For further information about the goodreads OAuth process: Goodreads API Documentation

If the user granted access you can now request an accessToken from the goodreadsAPI.

gr.getAccessToken()
.then(() => { /* you can now make authenticated requests */ });

That's it! You can now use the following methods:

getCurrentUserInfo()
followAuthor(authorID)
unfollowAuthor(authorID)
showFollowing(followingID)
getUserFollowings(userID)
addBooksToShelf(bookID, shelfName)
followUser(userID)
getRecommendation(recommendationID)
getFriendRequests([page])
answerFriendRecommendation(recommendationID, response)
answerFriendRequest(requestID, response)
addFriend(userID)
joinGroup(groupID)
getNotifications([page])
getOwnedBooks(userID, [page])
deleteOwnedBook(bookID)
unlikeResource(resourceID)
deleteReview(reviewID)
getBooksOnUserShelf(userID, shelfName, [queryOptions])
getCurrentUserInfo()

Contribute

  • coming soon
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].