API output
Success
In response to a request for a resource, in case of success, the API returns the HTTP 200 OK
status and a UTF-8 encoded JSON object.
All the analysis resources, whether document analysis, document classification or information extraction, share this output format:
{
"success": true,
"data": {
"content": analyzedtext,
"language": languagecode,
"version": engineinfo,
resourcespecificproperties
}
}
Self-documention resources have their peculiar output format.
The value of the Boolean property success
indicates that processing was successful while the data
object contains the results of the analysis.
The data
object always has the following properties:
content
: the text that's been analyzed.language
: the text language expressed as a ISO 639-1 language code.version
: text intelligence engine information.
After these properties, resource specific properties (resourcespecificproperties
) follow.
For more information about those properties, refer to the following articles:
-
Document analysis:
Managed errors
In response to a request for a resource, in case of a managed error, the API returns the HTTP 200 OK
status and a UTF-8 encoded JSON object with the following structure:
{
"success": false
"errors": [
{
"code": errorcode,
"message": errormessage
}
],
}
The value of the Boolean property success
indicates that processing was not successful while the error
object's properties code
and message
contain the error code and the error message respectively.
For example, when the request for document analysis or classification resource is a JSON object without the text
property, you get this object:
{
"errors": [
{
"code": "PREPARE_DOCUMENT_FAILED",
"message": "missing layout key in json"
}
],
"success": false
}
Other errors
In case of unmanaged application errors or other anomalies, the API returns specific HTTP status codes.