Jerry Nixon @Work: Easily use Yahoo!’s Local Search REST API in your Metro App

Jerry Nixon on Windows

Thursday, June 14, 2012

Easily use Yahoo!’s Local Search REST API in your Metro App

imageBing, Google, Yahoo. They all have a series of APIs you can call to use their services in your Metro application. one of the more compelling services is Yahoo!’s Local Search API which allows you to find local businesses based on latitude and longitude.

Local Search

The latest version of the Local Search Web Service allows you to search the Internet for businesses near a specified location, and now returns both the latitude and longitude and Yahoo! user ratings of the establishment, as well as search by business categories.

First, get a key

Keys for Yahoo! services are easy to get. From what I can tell, most of their services are free for developers. And so is the developer key. So, navigate to here and get your key.

Second, copy my LocalSearchHelper

You heard me right. Just copy my class into your project and start going. It really is that easy. You might want to leave my code as I wrote it. You might want to learn from my code and write your own. You might want to extend my code. Whatever you want, it’s up to you.

Get the code here.

Here’s what the API looks like:

Constructor(s)

LocalSearchHelper(key);

Example:

var _Helper = new LocalSearchHelper(“youneedyourownkey”);

Method(s)

SearchAsync(query, type);

Example:
var _Results = async SearchAsync(“coffee”, SearchTypes.Web);

The Yahoo local search is pretty simple, really. But don’t let that fool you. The Yahoo search returns an incredible amount of information back to you. The Yahoo Local search is the alternative to the Microsoft Bing Search API Phonebook search (which is being discontinued).

Conclusion

This is one of a family of helpers. Check them all out. 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!

Best of luck!