Modifier

Partager via


Spell Check API v7 response objects

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

If the request is successful, the top-level object in the response is the SpellCheck object. If the request fails, the top-level object is ErrorResponse.

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[]

FlaggedToken

The word that is not spelled correctly or is grammatically incorrect.

Name Value Type
offset The zero-based offset from the beginning of the text query string to the word that was flagged. Integer
suggestions A list of words that correct the spelling or grammar error. The list is in decreasing order of preference. TokenSuggestion[]
token The word in the text query string that is not spelled correctly or is grammatically incorrect. String
type The type of error that caused the word to be flagged. The following are the possible values:
  • RepeatedToken — The word was repeated in succession (for example, the warm warm weather)

  • UnknownToken — All other spelling or grammar errors.
String

SpellCheck

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), but the body of the response is empty.

Name Value Type
_type A type hint, which is set to SpellCheck. String
flaggedTokens A list of words in text that were flagged as not being spelled correctly or are grammatically incorrect.

If there were no spelling or grammar errors found, or the specified market is not supported, the array is empty.
FlaggedToken[]

TokenSuggestion

The suggested spelling or grammar correction.

Name Value Type
score A value that indicates the level of confidence that the suggested correction is correct. If the mode query parameter is set to Spell, this field is set to 1.0. Double
suggestion The suggested word to replace the flagged word with.

If the flagged word is a repeated word (see the type field), this string is empty.
String