Jerry Nixon on Windows: Easily use Yelp’s REST API v1 to get Restaurant Data in Metro App

Wednesday, June 13, 2012

Easily use Yelp’s REST API v1 to get Restaurant Data in Metro App

imageSo many of the cooler services out there have have free APIs. The data from those APIs can add considerable value to your application. Using these APIs can vary in complexity quite a bit. I have implemented a lot of these recently, and thought I would share the Yelp REST API version 1.

First: get a developer key

Yelp gives out developer keys for free. All you have to do is navigate to here and create an account, verify your email, and request an API key. When you do, you’re going to want your APP v1.0 key. A key looks like this: grwU5qatvNzGcbCR8ODWfg – but you will need your own to use the API in your application.

Second: Copy my YelpV1 helper

imageThat’s right, I have done all the initial work for you. It is possible my helper has everything you will never want from Yelp. Then again you may want to extend it. That’s totally up to you.

Get the code here.

The Helper’s API looks like this:

Constructor(s)

YelpV1Helper(key);

Example:
var _Helper = new YelpV1Helper(“grwU5qatvNzGcbCR8ODWfg”);

Method(s)

SearchAsync(query, latitude, longitude, category, limit, radius);

Example:
var _Results = SearchAsync(“coffee”, 39.502683d, -105.360174d);

It’s really that easy. If it was difficult to use, it would not be a “helper” would it? The reality is, you don’t need to use my code, you can reference it and build your own. Or you can use it, save yourself some time, and send me a note letting me know is worked!

Conclusion

There’s no user license or anything like that. I wrote this for a project I was doing and am just sharing the whole thing with you to have fun with. Remember, go get your key before you begin. Then copy my helper into your project and start using external data.

Note: since there is a version 2 API, I think it important to note that this API is not identical. The search results are FAR inferior to those of version 2. However, the API is superior only in that it requires a simple key and not OAuth, which can be difficult to use – and get right. Here’s the V1 Yelp documentation.

Best of luck!