Implement Text Search Using Yelp API

Posted in API, Web Tagged , , ,

yelp-api

The Yelp API follows the OAuth method of authentication. Once you sign up for the developer account, you get the consumer key, consumer secret, token, token secret variables. These need to be passed to the Yelp API along with the search query and location details. The output is returned as a JSON string which can then be parsed to obtain the various details of search results. The API returns the rating number, rating stars data, detailed address of the place and the phone number. However if you are interested in reading more info about the place like reviews then they have a constraint to link back to the Yelp business page of the place.  This is a bit of a limitation if you want to display the data directly inside your application.

Integrate Google Places API for Text Search

Posted in API, Web Tagged , , ,

Problem

Build a prototype using Google Places API which will search for all the restaurants, based on any text query entered for a given location. The search results should return the place photos, place details, reviews and ratings.

Solution Provided

google-places

The Google places API needs an API key to operate. Once that is generated by signing up, they are a number of web service calls which have to be made to fetch the relevant data. The text-search service was used to obtain the data for the specified text query. The request was made using CURL in PHP. Not all the place details that are needed are returned by the text-search service alone. It gives a key called as a reference id which needs to be passed on to a place details service which then returns the detailed info of the place. The photos of the place were obtained using the place photo web service call.  The photo reference key obtained from the detail request needs to be passed as part of the photo service call. You can also pass the maxwidth / maxheight parameter and the thumbnail will be returned with the mentioned dimension and correct aspect ratio.

Radius search was also implemented to fetch the data based on a specified miles range.