Search code examples
bingbing-api

How do i return JSON results from BING Search Engine API


At the moment i am only able to do my searches based on logging in to datamarket azure.

Results returned are formatted in a table form and i dont fidn any way to return them in JSON format.

A link is displayed after results are returned but when that link is pasted in the URL section of a browser it requires a username and a password.

Example of returned URL https://api.datamarket.azure.com/Bing/Search/v1/Web?Query=%27car%27

There used to be an api Using REST for it but now it only return errors and is no longer working.

Is there any way to use this BING API and retrieve it's return queries?

Returned Error after failing to attempt to log in to azure The authorization type you provided is not supported. Only Basic and OAuth are supported


Solution

  • You need to remove the v1 from your URL, and add $format=json to the end of your query, as detailed in the schema guide:

    https://api.datamarket.azure.com/Bing/Search/Web?Query=%27Xbox%27&$format=json
    

    To get the link to work, you need to provide it your hashed credentials, to get that, follow these steps:

    1. Login to the Azure Marketplace.
    2. Browse to the search api listing
    3. Click on the "Explore this Dataset" link (its only visible if you are logged in).
    4. Once it opens, on the top click on "Show" next to "Primary Account Key" enter image description here
    5. Save this hashed value and use it in your code as the authentication digest.