#CognitiveServices–#Bing Autosuggest API, cool new feature and some sample code

Hi !

After my yesterday post on how to get the new Cognitive Services API keys, today I’ll review one of the new services: Bing Autosuggest API. So as the main documentation explains:

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.


GitHub Sample https://github.com/elbruno/Blog/tree/master/CognitiveServices/BingAutoSuggest

Greetings @ Toronto

-El Bruno


2 thoughts on “#CognitiveServices–#Bing Autosuggest API, cool new feature and some sample code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.