The Bing Autosuggest API lets partners send a partial search query to Bing and get back a list of suggested queries that other users have searched on. In addition to including searches that other users have made, the list may include suggestions based on user intent. For example, if the query string is “weather in Lo“, the list will include relevant weather suggestions.
As today, there is no samples or client library in the official SDK, so I decided to create one of my own for this. In my samples repository, you’ll find a 2 projects solution which includes a sample console app and the Client library to work with the Bing Autosuggest API.
The AutosuggestClient class is the one who performs the calls to the API and also transforms the JSON result into .Net classes. Cool experience here, I found a nice website: http://json2csharp.com/ which basically generates the necessary .Net clases from a JSON response.
So with this, I generate my contract classes and my AutoSuggest library becomes a little more friendly.
Finally the ServiceClient class, is based on the Microsoft.ProjectOxford.Common.ServiceClient class and uses some basic HttpClient code to perform the request to the Bing API.
Now in Toronto, my sample and test search criteria will change a little, in example make a search for “toronto rap” will return results like “toronto raptors”, “toronto raptors schedule”, and more.
Greetings @ Toronto
- Cognitive Services Home
- Cognitive Services APIs
- Cognitive Services Documentation
- Cognitive Services App Gallery
- Bing Autosuggest API
- El Bruno How to start with some basic Azure configuration