Overview

The New York Times web site provides a rich set of APIs, as described here: https://developer.nytimes.com/apis You’ll need to start by signing up for an API key. Your task is to choose one of the New York Times APIs, construct an interface in R to read in the JSON data, and transform it into an R DataFrame.

You can find rpubs here

And Github here

Environment preperation

options(stringsAsFactors = FALSE)
library(httr)
library(jsonlite)
library(DT)

Access and convert the data for the movies API.

I mainly focused on the movie review API from NYT.

# setup the link for the API
url <- "https://api.nytimes.com/svc/movies/v2/reviews/search.json"

#pull the data
nyt <- paste0(url, '?api-key=', apiKey)

nyt1 <- fromJSON(nyt, flatten = TRUE)

Show the table and conclusion for the movie review table.

As we see below the resutl is table for the movies review

# setup the table
datatable(nyt1$results)