Yelp Fusion API Profile: Pull Local Business Data

Lindsey at RapidAPI
The Era of APIs
Published in
5 min readJan 5, 2017

Yelp currently has over 115 million reviews. Even better? You can access them programmatically. Today, we’re profiling Yelp’s Fusion API in our #12DaysOfAPIs series. We talked to the API tech lead, Tomer Elmalem, to get the inside scoop.

What the Yelp Fusion API can do

Using Yelp’s Fusion API, you can search local businesses and pull reviews, phone numbers and accepted transaction types (ex. food delivery and pick-up). The Yelp Fusion API actually is made up of multiple APIs, but we combined them all into a single package that lets you make calls straight from your browser. You can also export the code snippet directly into your script.

Although we do always love a good nom, Yelp’s API isn’t just for restaurant reviews.

Source: Imgur

In fact, we were surprised to learn that restaurants aren’t even the most popular category on Yelp. You can export data from any local business with a Yelp page, from dentist offices to dog washers.

How to use the Yelp Fusion API

Step 1: Get the Yelp API Credentials

In order to use the Yelp API, you’ll need to register for a Yelp account and get the appId and appSecret. Here’s how to get them:

  • Sign up or Log in to Yelp
  • Go to Create App
  • In the create new app form, enter information about your app accordingly, then agree to Yelp API Terms of Use and Display Requirements. Then click the “Submit” button.
  • Now you can get the appId and appSecret on this page.

Step 2: Make a call with RapidAPI

Now that you have the appId and appSecret, head over to RapidAPI’s Yelp package page. Use the getAccessToken endpoint to (you guessed it!) generate an access token for the app.

After generating an access token, you can start to pull information from the API. Here’s an example call of the getBusinesses endpoint searching for ramen in San Francisco.

yelp-api-call-gif

Check out the package for yourself here to make a test call.

Project ideas

You could build a lot with this data. One of our favorite integrations is this map of San Francisco by Katie Hempenius.

sf-map

Source: Katie Hempenius

Some of the coolest integrations though, are from combining the Yelp API with other APIs. Since RapidAPI lets you call multiple APIs through one abstraction layer, the process doesn’t involve spending all your time digging through docs. Here are some project ideas that you could build with multiple APIs:

  • Extract phone numbers from the Yelp API and make calls with the Twilio API (here’s our #12DaysOfAPIs profile on Twilio and API tutorial for reference)
  • Build a lunch recommendation Slack bot that can pull highest rated Yelp places around your office. You can build the script to respond to user input (ex. “Chinese, $”) or generate top-rated places randomly. (Pro tip: use the Wit.Ai or API.AI packages to make the bot more conversational).

Let us know what you build in the comments below! We’d love to see your projects.

Why we ❤️ Yelp: Commitment to developers and open source

One thing we love about Yelp is their commitment to providing developers with as many tools and as much data as possible. Yes, the Yelp Fusion API uses the exact same search and autocomplete functions that the Yelp website uses. But the company also provides a robust open source platform with over 76 projects, including their Python PaaSTA (platform as a service) platform.

In addition to the Fusion API and open source platform, Yelp also offers a more comprehensive knowledge platform with deeper data, including sentiment analysis. The reviews giant also puts on an annual data set student challenge with a cash prize. Overall, Yelp seems pretty committed to inviting developers involved — they even have a $15,000 bug bounty program.

Behind the scenes: Yelp’s move from monolith to microservices

After speaking with Tomer, we learned more about Yelp’s commitment to APIs internally. They have a great content series explaining the technical challenges of moving from one giant monolith to multiple microservices. Here’s a quick overview from one article:

In 2011, Yelp had more than a million lines of code in a single monolithic repo, “yelp-main”. We decided to break the monolith apart into a service oriented architecture (SOA), and by 2014 had more than 150 production services, with over 100 services owning data. Breaking apart “yelp-main” allowed Yelp to scale both development and the application, especially when coupled with our platform-as-a-service, PaaSTA.

We also had the pleasure of hearing Infrastructure Tech Lead John Billings speak at API World in 2016. He explained that, while the monolith still exists (with 3M lines of code), Yelp has been able to move 891K lines, or 22% of its code base, into microservices. Here’s a slide he showed demonstrating how quickly the Yelp team embraced microservices over the years.

screen-shot-2017-01-04-at-11-33-53-am

The code base is primarily in Python, so if this kind of work interests you and you write in Python, check out their openings.

Happy coding and stay tuned for more API profiles!

We still have a few more API profiles to go, so follow along on Twitter (@rapid_api), Facebook or our blog.

--

--

Lindsey at RapidAPI
The Era of APIs

Director of Content at RapidAPI, a platform that helps developers find and connect directly to the world’s top APIs.