Search code examples
iosios7google-places-apiyelp

How to search local business by name, location in iOS?


I am working on project in which we are displaying local business search. I am using YELP to search local business. As per YELP Documentation i have created query. But it gives result based on location only.

I am trying with Google Place API but not getting desired result.

My YELP request - http://api.yelp.com/v2/search/?term=restaurant&location=nyc&limit=20&offset=1 My Google Place API request - https://maps.googleapis.com/maps/api/place/textsearch/json?query=hotels+in+nyc&sensor=true&key=AIzaSyCHwd5OgRXdeuTWV46SHdMLq2lXL20t22U

  1. How can i get result by business name & location as well using any YELP or Google Place API?
  2. Which one is better to use YELP or Google Place API?

Solution

  • I solve my problem using Google Places API -

    Thanks to This Answer.

    We get JSON/XML response

    1. Search hotels near City:

    https://maps.googleapis.com/maps/api/place/textsearch/json?query=hotels+in+Pune&sensor=true&key=AddYourOwnKeyHere

    1. Search specific place in city:

    https://maps.googleapis.com/maps/api/place/textsearch/json?query=[SearchPlaceName]+in+[CityName]&sensor=true&key=AddYourOwnKeyHere

    1. Search specific place in city by given type:

    https://maps.googleapis.com/maps/api/place/textsearch/json?query=[SearchPlaceName]+in+[CityName]&type=[PlaceType]&sensor=true&key=AddYourOwnKeyHere

    • To retrieve image/icons for restaurant/place -

    As per Documentation.

    We can use photo_reference & request like -

    https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CoQBegAAAFg5U0y-iQEtUVMfqw4KpXYe60QwJC-wl59NZlcaxSQZNgAhGrjmUKD2NkXatfQF1QRap-PQCx3kMfsKQCcxtkZqQ&key=AddYourOwnKeyHere