Asynchronous file Language Identification
Trigger language identification
This call will allow the user to identify the source language of a given file input.
Linux
curl -XPOST \
-H "Content-Type:multipart/form-data" \
-H "Authorization:Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI" \
-H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555" \
-F "input=@\"./demo.txt\";filename=\"demo.txt\"" \
-F "inputFormat=PLAIN" \
'https://api.languageweaver.com/v4/multi-language-identification/async'
Windows
curl -XPOST^
-H "Content-Type:multipart/form-data"^
-H "Authorization:Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI"^
-H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555"^
-F "input=@\"demo.txt\";filename=\"demo.txt\""^
-F "inputFormat=PLAIN"^
https://api.languageweaver.com/v4/multi-language-identification/async
Request Body:
(Request Body)
--8MsmExZ-SgFlDSniddeMZOkUV90emq
Content-Disposition: form-data; name="input"
Content-Type: application/octet-stream
Content-Length: 9
doc 1
--8MsmExZ-SgFlDSniddeMZOkUV90emq
Content-Disposition: form-data; name="inputFormat"
Content-Type: text/plain;charset=UTF-8
Content-Length: 10
text/plain
--8MsmExZ-SgFlDSniddeMZOkUV90emq--
Access token type
User credentials - Allowed User Roles: Admin, Linguist, Translator
API credentials
HTTP Request
POST /v4/multi-language-identification/async
Headers
Name | Value (example) | Description |
---|---|---|
Authorization | Bearer asd0eXAi... | Bearer token |
Trace-ID | 2c0c4dda-8333-4538-983e-e098de7cf555 | Optional unique request identifier (UUID) provided by client |
Request Parameters
Format
multipart/form-data
Name | Type | Mandatory | Default value | Description |
---|---|---|---|---|
input |
file | yes | The binary content of the file | |
inputFormat |
string | no | PLAIN | Format of input content. See Input Formats. |
Response JSON:
{
"requestId": "80fe4962-be9e-11e9-b972-2a2ae2dbcce4"
}
Response
Headers
Name | Value (example) | Description |
---|---|---|
BeGlobal-Request-ID | dbbbc062-88a7-4783-8d52-dea795e517f4 | Unique request identifier (UUID) |
Trace-ID | 2c0c4dda-8333-4538-983e-e098de7cf555 | The identifier provided in the request (UUID) |
Format
JSON
Name | Type | Description |
---|---|---|
requestId |
string | The id of the language identification request. This has to be used for the subsequent calls. |
{
"errors": [
{
"code": 1000,
"description": "Failed to store language detection information"
}
]
}
Error Response
Format
JSON
Name | Type | Description | |
---|---|---|---|
errors |
list | A list with the errors that occurred | |
code |
integer | The code of the error | |
description |
string | The description of the error |
Returned HTTP Codes:
Http Code | Description |
---|---|
200 | Language detection was successfully triggered |
400 | Input data is not valid |
401 | Authentication process failed or the access token is not valid |
403 | Forbidden to access resource |
500 | Application internal error |
Check the status of language identification
This call will allow the user to check the status of a previously triggered language detection. The status can be: INIT, IN_PROGRESS, DONE, FAILED.
- If the status is DONE the result of the identification can be retrieved.
- If the status is IN_PROGRESS then the status call has to be triggered again.
- If the status is FAILED then it needs to be submitted again.
Linux
curl -GET -H 'Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI' -H 'Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555' \
'https://api.languageweaver.com/v4/multi-language-identification/async/80fe4962-be9e-11e9-b972-2a2ae2dbcce4'
Windows
curl -XPOST -H "Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI" -H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555" ^
https://api.languageweaver.com/v4/multi-language-identification/async/80fe4962-be9e-11e9-b972-2a2ae2dbcce4
Access token type
User credentials - Allowed User Roles: Admin, Linguist, Translator
API credentials
HTTP Request
GET /v4/multi-language-identification/async/{requestId}
Headers
Name | Value (example) | Description |
---|---|---|
Authorization | Bearer asd0eXAi... | Bearer token |
Trace-ID | 2c0c4dda-8333-4538-983e-e098de7cf555 | Optional unique request identifier (UUID) provided by client |
Response JSON:
{
"status": "DONE"
}
Response
Headers
Name | Value (example) | Description |
---|---|---|
BeGlobal-Request-ID | dbbbc062-88a7-4783-8d52-dea795e517f4 | Unique request identifier (UUID) |
Trace-ID | 2c0c4dda-8333-4538-983e-e098de7cf555 | The identifier provided in the request (UUID) |
Format
JSON
Name | Type | Description |
---|---|---|
status |
string | The status of the language identification for given request identifier. Can be one of the following: INIT - input content was received by the system and will be validated IN_PROGRESS - the language detection is in progress DONE - the language detection is complete. When this status is returned, the retrieve result call should be triggered. FAILED - the language identification failed. When this status is returned the GET status calls should stop because there is no way to recover from this state. |
{
"status": "FAILED",
"errors": [
{
"code": 41,
"description": "Language detection failed"
}
]
}
Error Response
Format
JSON
Name | Type | Description | |
---|---|---|---|
status |
string | ||
errors |
list | A list with the errors that occurred | |
code |
integer | The code of the error | |
description |
string | The description of the error |
When the language detection status is "FAILED" the response will contain also the failure reason.
Returned HTTP Codes:
Http Code | Description |
---|---|
200 | Status was successfully retrieved |
400 | Input data is not valid |
401 | Authentication process failed or the access token is not valid |
403 | Forbidden to access resource |
500 | Application internal error |
Retrieve the result of language identification
This call will allow the caller to get the result of a triggered language identification, based on a request identifier.
The result of the language identification is by default stored for 48 hours. In case the account's DELETE_CONTENT feature is enabled, the result of the language identification is deleted after its first successful retrieve.
Linux
curl -GET -H 'Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI' -H 'Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555' \
'https://api.languageweaver.com/v4/multi-language-identification/async/80fe4962-be9e-11e9-b972-2a2ae2dbcce4/result'
Windows
curl -XPOST -H "Authorization: Bearer asd0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsI" -H "Trace-ID: 2c0c4dda-8333-4538-983e-e098de7cf555" ^
https://api.languageweaver.com/v4/multi-language-identification/async/80fe4962-be9e-11e9-b972-2a2ae2dbcce4/result
Access token type
User credentials - Allowed User Roles: Admin, Linguist, Translator
API credentials
HTTP Request
GET /v4/multi-language-identification/async/{requestId}/result
Headers
Name | Value (example) | Description |
---|---|---|
Authorization | Bearer asd0eXAi... | Bearer token |
Trace-ID | 2c0c4dda-8333-4538-983e-e098de7cf555 | Optional unique request identifier (UUID) provided by client |
Response JSON:
{
"encoding": "utf8",
"languages": [
{
"code": "eng",
"name": "English",
"languageTag": "en",
"score": 0.99
}
],
"scripts": [
{
"code": "Latn",
"name": "Latin",
"percent": 80.6
},
{
"code": "Zyyy",
"name": "Common",
"percent": 19.4
}
]
}
Response
Headers
Name | Value (example) | Description |
---|---|---|
BeGlobal-Request-ID | dbbbc062-88a7-4783-8d52-dea795e517f4 | Unique request identifier (UUID) |
Trace-ID | 2c0c4dda-8333-4538-983e-e098de7cf555 | The identifier provided in the request (UUID) |
Format
JSON
Name | Type | Description | |
---|---|---|---|
encoding |
string | Source content encoding | |
languages |
array | Array of detected languages, sorted in descending order of their score | |
code |
string | Detected language code. See Languages Table. | |
languageTag |
string | Detected language tag | |
name |
string | Detected language full name. See Languages Table. | |
score |
float | A value between 0 and 1; the closer the value is to 1, the greater the association between the detected language and source content | |
scripts |
array | Array of scripts that constitute the input text, sorted in descending order of the percentage of characters using that script. | |
code |
string | ISO-15924 code of detected script. See Script Codes. | |
name |
string | Name of detected script | |
percent |
float | Percentage of source content using specific script |
{
"errors": [
{
"code": 61,
"description": "result not found for requestId 80fe4962-be9e-11e9-b972-2a2ae2dbcce4"
}
]
}
Error Response
Format
JSON
Name | Type | Description | |
---|---|---|---|
errors |
list | A list with the errors that occurred | |
code |
integer | The code of the error | |
description |
string | The description of the error |
Returned HTTP Codes:
Http Code | Description |
---|---|
200 | Result was successfully returned |
400 | Input data is not valid |
401 | Authentication process failed or the access token is not valid |
403 | Forbidden to access resource |
500 | Application internal error |