Open Movie Database API

Author

Liam

How to Interact with the Open Movie Database API

The OMDb API allows users to interact with and search a database of thousands of movies and shows. The characteristics returned with each request include the rating, director, plot, awards, and much more! You can also filter your search by type (movie, series, episode), year of release, and more in cases such as remade movies and trilogies with similar names. For demonstration purposes, I will walk through the steps on how to retrieve information about one of the best Christmas movies ever made…Elf!

Step 1: Request API

Not all APIs require a personal API key, but this one does, so to do so one must…

  1. Go to this link: https://www.omdbapi.com/apikey.aspx
  2. Follow the ‘Free’ account type prompts and submit
  3. Check for an email and then click the bottom URL to activate

Then, you’re good to proceed!

Step 3: Create a Value for the Specific Movie

Here, we will create a value for our API link for the specific movie (Elf in this case) we would like to get information on.

movie_title <- "t=Elf"

Step 4: Create the URL

Append the endpoint, movie specification, and API key together to get the completed URL.

omdb_api_url <- 
  paste(db_endpoint,movie_title,your_api_key, sep ="")

Step 5: Create the Output!

In this step, we extract our requested data and convert it to a form that creates an easy-to-read data frame! Note that there will be multiple instances, which are unique in the fact that each displays different rating sources with respective scores.

this_movie <- omdb_api_url %>% 
  GET() %>% 
  content(as = "text",
          encoding = "UTF-8") %>% 
  fromJSON(flatten = TRUE) %>% 
  as_tibble()

Summary

This is a fun API that can provide very useful information about any movie or show you want. Whether you’re getting in an argument with your friend over who directed a series or you’re curious how much money a film made from the box office, the possibilities are endless!