DATA 607 Web APIs
Connecting the NY Times API
Best Selling Books
options(stringsAsFactors = FALSE)
library(jsonlite)
library(httr)
library(DT)
url <- "https://api.nytimes.com/svc/books/v3/lists/best-sellers/history.json"
api.key <- readLines("https://raw.githubusercontent.com/crarnouts/CUNY-MSDS/master/NY_Times_API_Key")
url <- paste0(url, '?api-key=', api.key)
df <- fromJSON(url, flatten = TRUE)
datatable(df$results)