Assignment 5 API

Author

Joe Galuppo

Introduction

In this document I will be investigating the Yelp API and provide examples to my classmates about why it would be interesting to use and how to interact with it.

YELP API

Yelp is a business reviewing platform with data about businesses, locations, ratings, and reviews. We can collect all this data in an API. With this data we can do lots of things such as comparing and contrasting the hottest new restaurants in a specific city. Look at ratings of the same type of restaurant in the same year. Or even look at business engagement. There are lots of things we can do using the Yelp API. Following are the instruction on how to set it up.

Set-up

Yelp

Follow these steps to set up your Yelp API!

1) create an account on yelp, you can follow this link, https://www.yelp.com/signup?return_url=https%3A%2F%2Fwww.yelp.com%2Fseeyousoon

2) Verify your email you used for that account.

3) Create an app using this link, https://www.yelp.com/developers/v3/manage_app

  1. Fill out the fields accordingly.

  2. Next hit the create button after filling out all the fields, claiming you are human, and checking the terms and conditions box.

  3. Finally find the Client Id and API key on the next page and copy and paste them into the appropriate places below

R

First we need to install the packages

install.packages("devtools", repos = "https://cran.r-project.org")
Installing package into 'C:/Users/joega/AppData/Local/R/win-library/4.3'
(as 'lib' is unspecified)
package 'devtools' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
    C:\Users\joega\AppData\Local\Temp\RtmpATOanj\downloaded_packages
devtools::install_github("OmaymaS/yelpr")
Skipping install of 'yelpr' from a github remote, the SHA1 (84734851) has not changed since last install.
  Use `force = TRUE` to force installation
library(devtools)
Loading required package: usethis
library(yelpr)

Next we are going to create variables for the API key.

Key <-"Enter API key here"

This should be all you need to access your API by using the yelpr package!

Demonstration

In this demonstration we will search for coffee shops in Cincinnati .

coffee_search <- business_search(api_key = Key,
                                location = "Cincinnati",
                                term = "coffee")
No encoding supplied: defaulting to UTF-8.
coffee<- coffee_search$businesses

With this we can see 20 coffee shops with a plethora of information that we could use in an analysis.