Sunday, March 21, 2010

Bing API 2.0: Get started

Getting an AppId

The first thing you need is an ApplicationId. The ApplicationId enables the API to validate that a request is from a registred Bing application developer.

You can request your ApplicationId at the Bing Developer Center.

Getting your first results

Next to the ApplicationId, the API requires the Query and Sources parameters. The Query parameter is the text of the query. The Sources parameter is one or more values indicating the SourceTypes you require. An overview of available SourceTypes can be found on MSDN.

You can use HTTP GET to send requests, meaning you can use your browser to get a feel of the API.

Here is how I built my first request..

I wanted to search for images for the query 'Mini Cooper S'. My url looked something like this: http://api.search.live.net/xml.aspx?AppId=[YourAppId]&query=Mini+Cooper+S&sources=image

And the result looked like this.


The results returned include a header and a results body. The document element is always a SearchResponse, with a Query child element that contains the query used to produce the results. The results body follows the header. The body contains the results per SourceType you specify in the url.

This post is part of the Bing API 2.0 series.

No comments:

Post a Comment