In the last few posts, we’ve explored a few aspects available to you as part of the wider group of Microsoft Cognitive Services APIs. Microsoft Cognitive Services puts the power of machine learning within your reach with easy to consume REST APIs. Using the APIs and SDKs can add a whole new level of cognitive awareness and intelligence to your applications.
Today, let’s take a closer look at the Search APIs and show you how to get started. The five Search APIs available are:
- Bing Autosuggest
- Bing Image Search
- Bing News Search
- Bing Video Search
- Bing Web Search
You can use the in-browser API test that you see linked after each topic to see these in action now. At the end of the article we’ll show you how to get a free trial and your APIs keys to start adding functionality to your app.
Okay, let’s dig in.
This API provides you with the same feature you see as you type into the Bing search box, providing intelligent suggestions based on the current query. The usage for this API is pretty simple, you send the query and get a response containing the suggestions. This API is typically used for application scenarios where you need an autocomplete search box, but can be used for much more as the results are not simple word matches, they’re intelligent and context aware suggestions.
Here’s an example of getting suggestions:
Resources for Bing AutoSuggest:
- Try the AutoSuggest API, in-browser, here
- API Reference
- API Guide
- See AutoSuggest used in the Intelligent Kiosk Demo
Bing Image Search
Bing Image Search puts millions of photos at your fingertips. You can define search parameters to get more accurate results. Parameters such as Market, SafeSearch, Color, Freshness, Image Type, License and Size.
Sending a query to the API will return thumbnails, full image URL, metadata (such as width & height), original website source and much more in an easy to use JSON response.
Here’s part of the result when searching “beaches”:
Resources for Bing Image Search:
- Try the Image Search API, in-browser, here
- API Reference
- API Guide
- See Image Search used in the Intelligent Kiosk demo
Bing News Search
With Bing News search API, you can get intelligent web search results containing news articles related to your query, quickly and within your application. In addition to the link to the article, this API will provide results containing the official article image, a video URL (if one is available), related articles and provider information (the source).
Just like with Image Search, you can use initial search parameters. The parameters are Market, SafeSearch and Freshness.
Here’s part of the result when searching “Microsoft Cognitive Services”:
Bing News Search Resources:
- Test the API in-browser here
- API Reference
- See News Search used in the Intelligent Kiosk demo
Bing Video Search
Similar to Image Search API, you can make a call to the API using parameters such as Market, SafeSearch, Pricing, Freshness, Resolution and Video Length. You’ll get a result containing the video name, description, video URL, thumbnail, creator, video view count, encoding information and a lot more.
Here’s an example search for “beaches” again, but using the Video Search API this time:
Bing Video Search Resources
Bing Web Search
To wrap up today’s post, let’s take a look at the Bing Web Search API. This API will deliver the trusted results you get from Bing into your application. You’ll have access to literally billions of web documents using this API and you can pass parameters such as Market, SafeSearch, Relevance and Freshness. In the results you can expect the web result with metadata, such as name, url, displayUrl and snippet.
For example, here’s a search for “Microsoft Cognitive Services” again, but this time using the Web Search API:
Additionally, if the result has deep links available, you’ll see a deepLinks array. Here’s the top of the JSON response for the same search:
Bing Web Search Resources
You can easily add some great functionality to your application by introducing one, or more, of the Cognitive Services APIs. As we promised at the top of the article, go here to enable the free trial and get your API keys, then swing by the Getting Started guide for a walk-through on how to get up and running.