Tuesday, July 14, 2009

Testing Bing's API

One of the interesting things about Bing is that, unlike Google Search, their search API carries no usage quota. The only API usage restriction is the requirement that Bing's API is used for “user-facing applications” only (i.e. not for data-mining or data-harvesting applications).

You can read all about Bing's API here
. The Bing API is an updated version of Microsoft's Live Search API, which explains why Bing's API is already at Version 2.0, despite Bing itself being just a few weeks old.

So let's put Bing's API to the test using the SOAPbox Web Services testing tool...

Open up SOAPbox, and then select "Request Settings" under the drop arrow next to the address bar:



Now enter the details for connecting up to Bing. The URL must contain your App ID. To quote Microsoft:

Getting an AppID is a straightforward process. First, go to the Bing Developer Center and sign in with your Windows Live ID. After signing in, you will be presented with a link to create a new AppID. Click the link, then supply basic information about your application and review the Terms of Use.

Your AppID then goes into the SOAPbox "Request Settings" page as shown below:

http://api.search.live.net/xml.aspx?Appid=PutYourAppIdHere&query=vordel&sources=web

Be sure to set the verb as "GET" (we're testing the REST API first - although SOAPbox has "SOAP" in its name, you can use it to test REST services).



Now press the green button to send the request up to Bing. We then see the search results in the results pane:



Now the fun begins. Click over from "Classic" mode to "Design" mode. In the bottom-left, click on the "Stress" tab. Configure a stress test like the one below. I've set it to send 100 searches up to Bing, using the same API key each time:



You can see from the results that all the requests went through fine. HTTP 200's all round. Bing's API had no problem with this kind of usage.

But, as Ralf Rottmann notes, you must "Restrict the usage to less than 7 queries per second (QPS) per IP address. Exceeding this limit must be approved with the team at api_tou@microsoft.com".





I guess you could say "this is not really a 'user-facing application', it's an example of automating a request". But, I'm a user and I'm facing SOAPbox :-)

Grab your copy of SOAPbox here and happy testing of Bing (and other APIs too).

0 comments: