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.
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
appSecret. Here’s how to get them:
- Sign up or Log in to Yelp
- Go to Create App
- Now you can get the
appSecreton this page.
Step 2: Make a call with RapidAPI
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.
Check out the package for yourself here to make a test call.
You could build a lot with this data. One of our favorite integrations is this map of San Francisco by Katie Hempenius.
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.
The code base is primarily in Python, so if this kind of work interests you and you write in Python, check out their openings.