Modifier

Partager via


Autosuggest API v7 response objects

For a list of possible objects, see In this article in the right pane.

If the request succeeds, the top-level object in the response is the Suggestions object. And if the request fails, the top-level object in the response is the ErrorResponse object.

Note

Because URL formats and parameters are subject to change without notice, use all URLs as-is. You should not take dependencies on the URL format or parameters except where noted.

Error

Defines the error that occurred.

Name Value Type
code The error code that identifies the category of error. For a list of possible codes, see Error codes. String
message A description of the error. String
moreDetails A description that provides additional information about the error. String
parameter The query parameter in the request that caused the error. String
subCode The error code that identifies the error. For example, if code is InvalidRequest, subCode may be ParameterInvalid or ParameterInvalidValue. String
value The query parameter's value that was not valid. String

ErrorResponse

The top-level object that the response includes when the request fails.

Name Value Type
_type Type hint, which is set to ErrorResponse. String
errors A list of errors that describe the reasons why the request failed. Error[]

QueryContext

Defines the query string that Bing used for the request.

Name Value Type
adultIntent Not used. Boolean
alterationOverrideQuery Not used. String
alteredQuery Not used. String
askUserForLocation Not used. String
originalQuery The user's query term. String

SearchAction

Defines a query search suggestion.

Name Value Type
displayText The suggested query term to display in a user interface. String
query The suggested query term.

If the user selects the query term from the list of suggestions, use the term in a Bing API request and display the search results yourself. Or, use the URL in the url field to send the user to the Bing search results page for the suggested query.
String
searchKind The type of suggestion. The following are the possible values:
  • CustomSearch — The suggestion is from a non-web search suggestion data source.
  • WebSearch — The suggestion is from a web search suggestion data source.
String
url The URL that takes the user to the Bing search results page for the suggested query. String

SuggestionGroup

Defines a group of suggestions of the same type.

Name Value Type
name The name of the group. The name identifies the type of suggestions that the group contains. For example, web search suggestions. The following are the possible group names:
  • Custom — The group contains suggestions from a non-web search suggestions data source.
  • Web — The group contains web search suggestions.
String
searchSuggestions A list of up to 8 suggestions. If there are no suggestions, the array is empty.

You must display all suggestions in the order provided. The list is in order of decreasing relevance. The first suggestion is the most relevant and the last suggestion is the least relevant. The size of the list is subject to change.
SearchAction[]

Suggestions

The top-level object that the response includes when the request succeeds.

If the service suspects a denial of service attack, the request succeeds (HTTP status code is 200 OK). However, the body of the response is empty.

Name Value Type
_type The type hint, which is set to Suggestions. String
queryContext The user's query string. QueryContext
suggestionGroups A list of suggested query strings grouped by type. For example, web search suggestions. SuggestionGroup[]