Bing Image Search API

UPDATE: 5th Sep 2012
Microsoft changed their Bing Search API so this tutorial doesn't work any more.
It's ridiculous but I'm not able to figure out how to get API Key for the new Search API in Microsoft Azure. If you're more successful than me, please drop me a comment!

Original article

I don't know the exact reason, but Google and Yahoo are closing their Image Search API (both are marked as deprecated at this moment) and probably the only choice is Bing Image Search API.

Unfortunately, MSDN documentation is quiet ambiguous and because Bing Image Search API is not really widespread it's hard to find some useful information.

But to be honest results from Bing are very good, you just need to get used to some peculiar practice.

So, for example if you're looking for pictures of Prague, your URL might look like this:

http://api.search.live.net/json.aspx?AppId=5B0D22D739247C06BE7F990ECBEC1A144F9B7C39
    &Sources=image&Query=prague&Image.Count=3
    &Image.Offset=0&Image.Filters=Size:Medium

... and response is following:

Nice thing is that each image contains link to it's original source and also link to it's thumbnail on Bing with size and mimetype included. Bing also supports three different format. XML, SOAP) and JSON. You can combine more filters together by just repeating the Image.Filters keyword (it won't rewrite preceding filters):

http://api.search.live.net/json.aspx?AppId=__ApiKey__
    &Sources=image&Query=prague&Image.Count=3
    &Image.Offset=0&Image.Filters=Size:Medium
    &Image.Filters=Size:Medium&Color:Monochrome=true

What you can't do (or I just don't know how) is to make "OR" statement. I mean, you can't let's say search for only small or medium images. For more information read about Filter property in MSDN.

By the way, if you were going to use this API, you need Live ID account to generate your own API Key. Please don't use mine, it might not work in the future :).

blog comments powered by Disqus