Search code examples
jsoncurlbing

Bing Search HTTP request with JSON result example?


Please help to figure out the parameters for Bing Search request that returns results in JSON.
Document "Migrating Bing Search API Applications" tells us:
To authenticate a Bing Search API request with Windows Azure Marketplace, you must obtain an account key. This mode of authentication replaces the AppID used in the Bing Search API 2.0.

On the other hand the same document provides the following example that still uses Appid:

http://api.search.live.net/xml.aspx?Appid=App&query=odata&sources=web&count=2

The following request:

curl "https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/v1/Web?Query=%27xbox%27&$top=50&$format=json$accountKey=TPP....VRTWiq4=$Appid=conceptor"

Results in the following error:
The authorization type you provided is not supported. Only Basic and OAuth are supported

Please give an example of Bing search URL that can be used in CURL command line to get search results in JSON format.


Solution

  • Now, you should only use datamarket.azure styled API calling. The old one cannot work any more. A big difference on authentication is that you don't need include your AppID in your query URL. A authentication window pops up and you need just provide your default account key (or any key you created in your account). See this very good summary of new Bing API