Bing Looking for an HTTP request with an example JSON result?

Please help figure out the parameters of a Bing search query that returns results in JSON. The Bing Search API Application Migration document tells us: β€œTo authenticate a Bing Search API request in the Windows Azure Marketplace, you must obtain an account key. This authentication mode replaces the AppID used in 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 query: curl "https://api.datamarket.azure.com/Data.ashx/Bing/SearchWeb/v1/Web? Query =% 27xbox% 27 & $ top = 50 & $ format = json $ accountKey = TPP. ... VRTWiq4 = $ APPID = ideological "

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

Please provide an example of a Bing search URL that can be used on the CURL command line to retrieve search results in JSON format.

+4
source share
3 answers

You should now only use the datamarket.azure API. Old can no longer work. The big difference in authentication is that you do not need to include your AppID in the URL of your request. An authentication window will open, and you just need to specify your default account key (or any key created in your account). See a very good summary of the new Bing API

+1
source

You need to send the application key in Base64 encoding to the main auth header.

Authorization: Basic {{ encoded_app_key }} 

BTW The previous answer refers to a review of the old Bing api, therefore it is not useful if you are in the api data market.

Here is your example using jQuery.

 $.ajax({ type:'POST', url:url, headers: { "Authorization": "Basic " + encodedAppKey } }).done(function(data) { alert(data); }); 

Useful link: http://social.msdn.microsoft.com/Forums/windowsazure/en-US/9f085915-81b6-488d-a348-1c3ca769d44f/migrating-to-windows-azure-bing-search-api-with-jquery -jsonp

+8
source

All of these answers are out of date. You must use JSONP to make the request a different url.

In an ajax request, use:

enter: "POST", jsonp: "jsonp",

+1
source

Source: https://habr.com/ru/post/1438503/


All Articles