Working with Yelp API and/or Google Places api

977 views Asked by At

Hi I have a project assigned to me for school that requires the use of either google places API or a Yelp API for the purpose of allowing users to search local restaurants or bars near a given location.

I have researched how to implement this over the past 2 days and am just at a loss as to how to proceed. I have never worked with an external api.

Our project must use AngularJS with Csharp. If anyone could point me to a beginners guide on how to connect the dots for this to work or wouldn't mind helping with a dummies explanation (something detailing the process) I would be EXTREMELY grateful.

Or is there a site that has open source example projects available for dissecting?

1

There are 1 answers

0
Jeff L On

So when working with API's the first thing you're going to want to do is read the documentation for whichever API you decide to go with to get a base understanding of what kind of calls you need to make.

Here is Google's.

Typically you'll need a unique key to identify yourself when you use API's so you'll need to sign up for a developer account and make sure you don't leave your key out in the open.

Taken from the Google documentation you just need to insert the following code WITH your API key where it says to insert it.

 <body>
        <div id="map"></div>
        <script>
          var map;
          function initMap() {
            map = new google.maps.Map(document.getElementById('map'), {
              center: {lat: -34.397, lng: 150.644},
              zoom: 8
            });
          }
        </script>
        <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap"
        async defer></script>
</body>

Once you have this you can test it by seeing if it shows up on your website and then start figuring out how you want to look up restaurants. One way to do this is to store the Latitute and Longitude of your restaurants in an array and have those get called in to the Google Maps code based on what you want to do with it.