Determining values for required parameters
In addition to a valid AppID, requests to any of the API interfaces require two additional parameters: Query and Sources.
The Query parameter is the text of the query you want the API to execute. For the sample request, we’re going to formulate, we will use the text "sushi."
The Sources parameter includes one or more values that indicate the SourceType or SourceTypes from which you want to request results. The API includes a number of different SourceTypes, which is part of what makes Bing an attractive search engine for your applications. To request results from multiple SourceTypes, separate the SourceType names with a plus (+) sign.
The Web SourceType returns a set of results relevant to the queried term. In addition to the Image and News SourceTypes, with which you might be familiar from using Bing online, there are also SourceTypes such as Spell and InstantAnswer. (For the beta release, only InstantAnswer using the Encarta information resource to provide answers to questions is available publicly.)
Bing API SourceTypes are presented in Table 1. For our sample request, we’ll use the Web SourceType. For more information, see Working with SourceTypes on MSDN.
Table 1: Bing API SourceTypes
SourceType | Description | Sample Query parameter |
---|---|---|
Web |
Searches for web content |
Sushi |
Image |
Searches for images on the web |
Sushi |
News |
Searches news stories |
Sushi |
InstantAnswer |
Searches Encarta online |
what is sushi convert 5 feet to meters x*5=7 2 plus 2 |
Spell |
Searches Encarta dictionary for spelling suggestions |
Coffee |
Phonebook |
Searches phonebook entries |
sushi in los angeles |
RelatedSearch |
Returns the query strings most similar to yours |
{inari sushi; sushi restaurant; California roll} |
Ad |
Returns advertisements to incorporate with results |
Sushi |