YelpSharp is a .NET wrapper for the Yelp REST API. It lets you do all kinds of interesting things like searching for businesses, getting user comments and ratings, and handling common errors. The library is written in C#, and available on NuGet.
C# HTML Shell
Latest commit be5b2d4 Apr 14, 2015 @JustinBeckwith Merge pull request #23 from AlAdler/master
Added search by phone number.
Permalink
Failed to load latest commit information.
.nuget
Samples first commit Feb 6, 2013
YelpSharp.WindowsPhone added phone support, went async Dec 21, 2012
YelpSharp Added search by phone number. Apr 13, 2015
YelpSharpTests Added search by phone number. Apr 13, 2015
.gitignore fixed the forever hang problem on GetBusiness call as the TCS wasn't … Jan 1, 2014
Local.testsettings initial commit Feb 13, 2012
TraceAndTestImpact.testsettings initial commit Feb 13, 2012
YelpSharp.nuspec
YelpSharp.sln
YelpSharp.vsmdi initial commit Feb 13, 2012
index.html swapped twitterizer for restsharp, more unit tests Feb 15, 2012
package.cmd updated readme, and added nuget build files Jan 13, 2013
readme.md update path to unit tests Dec 15, 2013

readme.md

YelpSharp

YelpSharp is a .NET wrapper for the Yelp REST API. It lets you do all kinds of interesting things like searching for businesses, getting user comments and ratings, and handling common errors. The library is written C#, and is available on NuGet.

For more information, visit the Yelp REST API

Installing

In most cases, you're going to want to install the YelpSharp NuGet package. Open up the Package Manager Console in Visual Studio, and run this command:

PM> Install-Package YelpSharp

How to Use

The source includes a few examples that should help you get started with ASP.NET and Windows Phone 8. Before you get started, you need to register for a Yelp developer account, and register for an API key. If you are looking for something and having trouble, you can always check out the unit tests.

Handling Tokens

The Yelp constructor takes a set of options that includes all of the keys neccesary to use the V2 Yelp API. Keep these keys safe! There are a variety of ways to store them. You can put them in the applicationSettings portion of your web.config (recommended), or store them in an environment variable on your dev machine:

var options = new Options()
{
    AccessToken = Environment.GetEnvironmentVariable("YELP_ACCESS_TOKEN", EnvironmentVariableTarget.Machine),
    AccessTokenSecret = Environment.GetEnvironmentVariable("YELP_ACCESS_TOKEN_SECRET", EnvironmentVariableTarget.Machine),
    ConsumerKey = Environment.GetEnvironmentVariable("YELP_CONSUMER_KEY", EnvironmentVariableTarget.Machine),
    ConsumerSecret = Environment.GetEnvironmentVariable("YELP_CONSUMER_SECRET", EnvironmentVariableTarget.Machine)
};

For a full example of conviently storing your tokens, check out the MvcSample.

Using the Search API

YelpSharp uses the Task Parallel Library (TPL) to make managing asynchronous requests easier. The search API has two different ways of searching for results. The simplest way is to pass a city and a search term. This will search Yelp for all coffee places around Seattle, WA (there are a lot).

var task = y.Search("coffee", "seattle, wa").ContinueWith((searchResults) =>
{
    foreach (var business in searchResults.Result.businesses)
    {
        Console.WriteLine(business.name);
    }
});

There are a lot of other ways to search. For more info, the best place to look is the unit tests.

Building the Source

If you want to build the source, clone the repository, and open up YelpSharp.sln.

git clone https://github.com/JustinBeckwith/YelpSharp
explorer YelpSharp\YelpSharp.sln

Supported Platforms

YelpSharp targets .NET 4.0, and Windows Phone 8. If you would like support for other platforms, let me know.

License

MIT License

Questions?

Feel free to submit an issue on the repository, or find me at @JustinBeckwith