top of page

Real-time data visualization using Yelp and Twitter API (tutorial)

Tools Used in this Process

API accessing

In this tutorial, we will talk about how to make an API call using a combination of Yelp v3 API, d3.js, and Postman. First of all, let's go to https://www.yelp.com/developers/documentation/v3/get_started to obtain an access token.

 

Create an app on Yelp's Developers site In order to set up your access to Yelp Fusion API, you need to create an app with Yelp. This app represents the application you'll build using our API and includes the credentials you'll need to gain access. Here are the steps for creating an app" 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 should get the client id and secret, which will be used in the next step to get an access token. Please keep the client id and secret to yourself since they are credentials for your call to Yelp's API. Get an access token To get an access token, make a POST call to the following endpoint using the client id and secretly obtained from the former step. Then get the access token from the response body. Authenticate API calls with the access token To authenticate API calls with the access token, set the Authorization HTTP header value as Bearer access_token.

function drawDots(){ var yelpapi= d3.json("https://api.yelp.com/v3/businesses/search?location=chicago&attributes=hot_and_new&limit=50") .header("Authorization", "Bearer ****") .get(function(error, yelp) { if (error) throw error;

API accessing

Visual exploration

bottom of page