Jerry Nixon @Work: Easily upgrade from Bing’s V2 API to Bing’s Data Marketplace API

Jerry Nixon on Windows

Monday, June 18, 2012

Easily upgrade from Bing’s V2 API to Bing’s Data Marketplace API

imageIt wasn’t that long ago when Bing released their REST API (http://api.bing.net) to fetch search information. It was simple and powerful, and I discussed it here. But not too long ago, Bing announced that the API will be migrating to the Azure Data Marketplace. As of August 1, 2012, the Marketplace version will be the ONLY option (it’s official).

The Bing Search API enables developers to embed and customize search results in applications or websites using XML or JSON. Add search functionality to a website, create unique consumer or enterprise apps, or develop new mash-ups.

imageIt’s free, unless your app rocks!

That’s right, the tiered pricing lets developers use the data (up to 5k transactions/mo) for free. Once you need more, you can get 10k, 20k, 50k, or more/month.

Each tier has a different price and it’s up to you to determine what’s best for you. If you need more than the basic, congratulations.

The Bing team provided this migration guide:

Bing API Migration Guide Resources for migrating existing applications to the Windows Azure Marketplace OData APIs.

So, should you want to upgrade, or just start using the Bing service to add value to your Metro application, you found the right place. Read the doc above. Then, read this article.

First, get your key

The Azure Data marketplace is handy. But like almost every service out there you need to get a key. Keys are, of course, free – so get started. Navigate to here and use your Windows Live Id.

imageSecond, copy my helper!

That’s right. I have another helper. The service uses Odata, which is super powerful. But since Metro hasn’t implemented Odata support just yet – I have taken care of the dirty work for you and created JSON calls and deserialized into C# classes. All for you!

Aside: once Odata is fully supported in Metro applications you should not really need my helper. Though it will keep working, using Odata will give you more query power. And who doesn’t like power? In the meantime, here we are.

Get the code here.

To use the helper, just copy the class into your project.

Here’s the helper’s simplified API:

Constructor(s)
BingApiV2Helper(key);

Example:

var _Helper = new BingSearchHelper(“youneedyourownkey”);
Method(s)

SearchAsync(String Query, String Sources = "web", Double? Latitude = null, Double? Longitude = null, String Market = "", String Adult = "Strict", String WebFileType = "", String ImageFilters = "", String VideoFilters = "", String VideoSortBy = "", String NewsLocationOverride = "", String NewsCategory = "", String NewsSortBy = "");

Example:
var _Results = SearchAsync(“coffee”);

In the tables above, I iterate the one and only method call. It does everything for you. Accessing the data is simple and the helper is meant to make it as easy as possible. Having said that, don’t forget what I said about Odata above.

Conclusion

Using real data in your application can really increase its value to the user. And increasing the value to the user can tip the scales against UNINSTALL, right? That’s the name of the game. Effective August 1, 2012 the old Bing API (version 2) will no longer be supported. That means this is your upgrade path.

But know this one caveat with the Bing search – the Phonebook search is completely deprecated. If you need a solution for that, check out this.

Best of luck!