Bing Search API
Introduction: This article
is a continuation of the series of articles starting with the description of
SignalR service. We followed up with a discussion of Azure Gateway service, Azure Private Link, and Azure Private Endpoint and the
benefit of diverting traffic to the Azure Backbone network. Then we started
reviewing a more public internet-facing service such as the Bing API.
Description:
Azure Bing API is developer-friendly and provides a
robust way of searching custom and scoped content with the same standard as the
public internet. A customized search instance can be created using the Bing custom search
portal. Bing Search API maintains an index for the internet
using web crawlers.
The Bing Search API is an Azure Resource available via
the Azure Marketplace. After logging in to the Azure portal, one can select
either the Bing API resource or the Bing Custom Search resource.
With a subscription key, the Bing Web Search API allows
searching billions of documents for content that is relevant to the user’s
search string with a simple HTTP GET method. The headers allow continuity
across api-calls and allow the responses to be more refined based on the
history of searches. Language is can also be specified in the header.
The query parameters include market to restrict the
search results. It can additionally include safe search preferences. The
text-decoration and text format can also be specified to enhance the search
experience. Count and offset can enable paging of the results.
Bing provides a response filter that is independent of
the REST-based parameters. The responseFilter can be used to specify entity
types that are to be searched. For example, it can include comma-separated
entities like webpages, news, images etc. Exclusions of entities can be
specified with a minus sign in the response filter. This is not a substitute to
call entity-specific search API if there is only one entity to be searched.
A request to the WebSearch API results in a
SearchResponse object in the response body. This object encapsulates plenty of
information in the form of ‘webPages’, ‘deepLinks’, malware notice,
‘contractual rules’, ‘images’, ‘videos’, ‘news’, ‘computation’, ‘timeZone’,
‘spellSuggestions’, ‘queryContext’, ‘places’, ‘entity’, ‘translations’,
and ‘rankingResponse’
Each search response includes a ranking response which
groups content by mainline content and sidebar content. Within each group, the items array lists the
order for the content to be displayed. This lets us refer to the results via
conventions like WebPages 0 through 9 or Entity 0.
The search API cannot be called beyond the maximum number
of queries per second otherwise the requests will fail with HTTP status code
429.
Analytics for the Bing Search API is provided by
‘enabling the Bing Statistics’ on the Bing Azure Resource via the Azure Portal.
Predefined dashboards show analytics.
Conclusion: These are the
ways in which the Bing Search Web API can be used, and it is available as just
another cloud resource along with the benefits that come with a cloud service.
No comments:
Post a Comment