After logging in and reading the spec sheet on the NYT Developer site, I created an account and got my dev keys. The spec shows an example call: https://api.nytimes.com/svc/movies/v2/reviews/search.json?query=godfather&api-key=yourkey. Below I will try it just to make sure it works with httr.

call <- GET("https://api.nytimes.com/svc/movies/v2/reviews/search.json?query=the+godfather&api-key=v8Fj971hg0hIrH00YLiGY2vyE2U1MXyv")
call
## Response [https://api.nytimes.com/svc/movies/v2/reviews/search.json?query=the+godfather&api-key=v8Fj971hg0hIrH00YLiGY2vyE2U1MXyv]
##   Date: 2022-04-03 22:53
##   Status: 200
##   Content-Type: application/json; charset=utf-8
##   Size: 2.32 kB

A satus 200 shows us that we have successfully connected, and the content type and size show us that we’ve received a json of size 6.8kb. Now to explore the returned result:

godfather_reviews <- content(call, "text")
godfather_reviews
## [1] "{\"status\":\"OK\",\"copyright\":\"Copyright (c) 2022 The New York Times Company. All Rights Reserved.\",\"has_more\":false,\"num_results\":4,\"results\":[{\"display_title\":\"Square Grouper: The Godfathers of Ganja\",\"mpaa_rating\":\"R\",\"critics_pick\":0,\"byline\":\"RACHEL SALTZ\",\"headline\":\"Adventures in the Drug Trades\",\"summary_short\":\"“Square Grouper” is a documentary about pot smuggling in South Florida in the 1970s and ’80s.\",\"publication_date\":\"2011-04-14\",\"opening_date\":\"2011-04-15\",\"date_updated\":\"2017-11-02 04:18:13\",\"link\":{\"type\":\"article\",\"url\":\"https://www.nytimes.com/2011/04/15/movies/square-grouper-movie-review.html\",\"suggested_link_text\":\"Read the New York Times Review of Square Grouper: The Godfathers of Ganja\"},\"multimedia\":null},{\"display_title\":\"The Godfather, Part III\",\"mpaa_rating\":\"R\",\"critics_pick\":1,\"byline\":\"Janet Maslin\",\"headline\":\"GODFATHER PART III (MOVIE)\",\"summary_short\":\"Mafia heir trapped by legacy of past. Coppola's director's cut. Deeply moving.\",\"publication_date\":\"1990-12-25\",\"opening_date\":\"1990-12-25\",\"date_updated\":\"2017-11-02 04:17:42\",\"link\":{\"type\":\"article\",\"url\":\"https://www.nytimes.com/1990/12/25/movies/review-film-the-corleones-try-to-go-straight-in-the-godfather-part-iii.html\",\"suggested_link_text\":\"Read the New York Times Review of The Godfather, Part III\"},\"multimedia\":null},{\"display_title\":\"The Godfather, Part II\",\"mpaa_rating\":\"R\",\"critics_pick\":1,\"byline\":\"VINCENT CANBY\",\"headline\":\"Godfather: Part II, The (Movie)\",\"summary_short\":\"\",\"publication_date\":\"1974-12-13\",\"opening_date\":\"1974-12-20\",\"date_updated\":\"2017-11-02 04:17:27\",\"link\":{\"type\":\"article\",\"url\":\"https://www.nytimes.com/1974/12/13/archives/godfather-part-ii-is-hard-to-define-the-cast.html\",\"suggested_link_text\":\"Read the New York Times Review of The Godfather, Part II\"},\"multimedia\":null},{\"display_title\":\"The Godfather\",\"mpaa_rating\":\"R\",\"critics_pick\":1,\"byline\":\"Vincent Canby\",\"headline\":\"THE GODFATHER (MOVIE)\",\"summary_short\":\"Puzo's Mafioso novel. Scalding and memorable.\",\"publication_date\":\"1972-03-16\",\"opening_date\":\"1972-03-24\",\"date_updated\":\"2017-11-02 04:17:26\",\"link\":{\"type\":\"article\",\"url\":\"https://www.nytimes.com/1972/03/16/archives/moving-and-brutal-godfather-bows.html\",\"suggested_link_text\":\"Read the New York Times Review of The Godfather\"},\"multimedia\":null}]}"

We should be able to take the JSON returned by the get call and turn it into a dataframe with jsonlite:

godfather_reviews_df = as.data.frame(fromJSON(txt = godfather_reviews))
head(godfather_reviews_df)

Now that I know it works, I can construct a function that acts as a wrapper around this API that accepts whatever strings I want and searches up the NYT site. It will return a data frame with the results.

findReviews <- function(search_string){
  api= "https://api.nytimes.com/svc/movies/v2/reviews/search.json?query=%s&api-key=v8Fj971hg0hIrH00YLiGY2vyE2U1MXyv"
  clean_string<-str_replace(search_string, " ", "+")
  call_string = sprintf(api, clean_string)
  get_result<-GET(call_string)
  unparsed_json <- content(get_result, "text")
  json_as_dataframe <- as.data.frame(fromJSON(txt = unparsed_json) )
}
ironman_reviews <- findReviews("Iron Man")
head(ironman_reviews)

More advanced versions of this function would be able to build more complicated query strings based on user input. This api allows filtering by different parameters like release date and reviewer name.