Lilt API Binding for Javascript
All URIs are relative to https://lilt.com/2
Method | HTTP request | Description |
---|---|---|
assignDocument | PUT /documents/share | Assign a Document |
createDocument | POST /documents | Create a Document |
deleteDocument | DELETE /documents | Delete a Document |
downloadDocument | GET /documents/files | Download a Document |
getDocument | GET /documents | Retrieve a Document |
markReviewDone | POST /documents/done/review | Mark review done |
markTranslationDone | POST /documents/done/translation | Mark translation done |
pretranslateDocuments | POST /documents/pretranslate | Pretranslate a Document |
unlockDocuments | POST /documents/done/unlock | Unlock documents |
uploadDocument | POST /documents/files | Upload a File |
DocumentAssignmentResponse assignDocument(body)
Assign a Document
Assign and unassign a Document for translation and/or review.
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.DocumentsApi();
let body = new LiltNode.DocumentAssignmentParameters(); // DocumentAssignmentParameters |
apiInstance.assignDocument(body).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
body | DocumentAssignmentParameters |
DocumentWithSegments createDocument(opts)
Create a Document
Create a new Document. A Document is a collection of one or more Segments. Documents are nested inside of Projects, and appear in the Project details view in the web app. Document-level relationships between Segments are considered by the machine translation system during adaptation. If there is no inherent document structure in your data, you still might consider grouping related Segments into Documents to improve translation quality.
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.DocumentsApi();
let opts = {
'body': new LiltNode.DocumentParameters() // DocumentParameters |
};
apiInstance.createDocument(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
body | DocumentParameters | [optional] |
DocumentDeleteResponse deleteDocument(id)
Delete a Document
Delete a Document.
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.DocumentsApi();
let id = 56; // Number | A unique Document identifier.
apiInstance.deleteDocument(id).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | A unique Document identifier. |
Blob downloadDocument(id, opts)
Download a Document
Export a Document that has been translated in the Lilt web application. Any Document can be downloaded in XLIFF 1.2 format, or can be retrieved in its original uploaded format by setting `is_xliff=false`. This endpoint will fail if either (a) export or (b) pre-translation operations are in-progress. The status of those operations can be determined by retrieving the Document resource. Example CURL command: ``` curl -X GET https://lilt.com/2/documents/files?key=API_KEY&id=274 -o from_lilt.xliff ```
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.DocumentsApi();
let id = 56; // Number | An unique Document identifier.
let opts = {
'isXliff': true // Boolean | Download the document in XLIFF 1.2 format.
};
apiInstance.downloadDocument(id, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | An unique Document identifier. | |
isXliff | Boolean | Download the document in XLIFF 1.2 format. | [optional] [default to true] |
Blob
DocumentWithSegments getDocument(id, opts)
Retrieve a Document
List a Document. The listing will include the pretranslation status for the document. When pretranslation is in progress for a document, the `GET /documents` endpoint's response will include `is_pretranslating = true` as well as a more detailed status property `status.pretranslation` one of `idle`, `pending`, or `running`.
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.DocumentsApi();
let id = 56; // Number | A unique Document identifier.
let opts = {
'withSegments': true // Boolean | Flag indicating whether full segment information should be returned.
};
apiInstance.getDocument(id, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | A unique Document identifier. | |
withSegments | Boolean | Flag indicating whether full segment information should be returned. | [optional] |
[Number] markReviewDone(body)
Mark review done
Mark the review of documents as done/undone in bulk. When being marked positively as done: - Documents must not already be marked as done for review. - Documents must already be marked as done for translation. - This request will also trigger an email notification. Example curl: ``` curl –X –request POST 'https://lilt.com/2/documents/done/review?key=API_KEY' \ –header 'Content-Type: application/json' \ –data-raw '{ \"documentIds\": [23921, 23922], \"isDone\": true }' ```
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.DocumentsApi();
let body = new LiltNode.DocumentDoneUpdateParameters2(); // DocumentDoneUpdateParameters2 |
apiInstance.markReviewDone(body).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
body | DocumentDoneUpdateParameters2 |
[Number]
[Number] markTranslationDone(body)
Mark translation done
Mark the translation of documents as done/undone in bulk. When being marked positively as done: - Documents must not already be marked as done and all segments must be confirmed. - This request will also trigger an email notification to a document's assigned reviewer that the document is ready for review. When being marked as un-done: - Documents must not be marked as complete for review. Example curl: ``` curl –X –request POST 'https://lilt.com/2/documents/done/translation?key=API_KEY' \ –header 'Content-Type: application/json' \ –data-raw '{ \"documentIds\": [23921, 23922], \"isDone\": true }' ```
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.DocumentsApi();
let body = new LiltNode.DocumentDoneUpdateParameters1(); // DocumentDoneUpdateParameters1 |
apiInstance.markTranslationDone(body).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
body | DocumentDoneUpdateParameters1 |
[Number]
DocumentPretranslateResponse pretranslateDocuments(body, opts)
Pretranslate a Document
Initiate pretranslation of a list of Documents. This request will mark document(s) as being pretranslated. Pretranslation in this context is: - Applying and confirming exact TM matches based on the Memory of the Project; - Translating all other segments via MT without confirming them. Example CURL command: ``` curl -X POST https://lilt.com/2/documents/pretranslate?key=API_KEY -d '{\"id\": [123]}' -H \"Content-Type: application/json\" ``` Document translation is an asynchronous process that, in effect, is performed in the background. To check the status of pretranslation for a document, use the `GET /documents` endpoint. When pretranslation is in progress for a document, the `GET /documents` endpoint's response will include `is_pretranslating = true` as well as a more detailed status property `status.pretranslation` one of `idle`, `pending`, or `running`. Once pretranslation is finished, the document can be downloaded via `GET /documents/files`.
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.DocumentsApi();
let body = new LiltNode.DocumentPretranslateParameters(); // DocumentPretranslateParameters |
let opts = {
'autoAccept': true, // Boolean | Deprecated, use body param instead. Optional parameter for auto-accepting 100% TM hits.
'caseSensitive': true, // Boolean | Deprecated, use body param instead. Optional for using case matching against TM hits.
'attributeToCreator': true, // Boolean | Deprecated, use body param instead. Optional parameter for attributing translation authorship of exact matches to document creator.
'mode': "mode_example" // String | Deprecated, use body param instead. An optional parameter indicating how the document will be pretranslated. The accepted values are `tm`, or `tm+mt`. Default is `tm`.
};
apiInstance.pretranslateDocuments(body, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
body | DocumentPretranslateParameters | ||
autoAccept | Boolean | Deprecated, use body param instead. Optional parameter for auto-accepting 100% TM hits. | [optional] |
caseSensitive | Boolean | Deprecated, use body param instead. Optional for using case matching against TM hits. | [optional] |
attributeToCreator | Boolean | Deprecated, use body param instead. Optional parameter for attributing translation authorship of exact matches to document creator. | [optional] |
mode | String | Deprecated, use body param instead. An optional parameter indicating how the document will be pretranslated. The accepted values are `tm`, or `tm+mt`. Default is `tm`. | [optional] |
[Number] unlockDocuments(body)
Unlock documents
Unlock documents for translation. Sets document \"Translation Done\" and \"Review Done\" to false. Example curl: ``` curl –X –request POST 'https://lilt.com/2/documents/done/unlock?key=API_KEY' \ –header 'Content-Type: application/json' \ –data-raw '{ \"documentIds\": [23921, 23922] }' ```
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.DocumentsApi();
let body = new LiltNode.DocumentDoneUpdateParameters(); // DocumentDoneUpdateParameters |
apiInstance.unlockDocuments(body).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
body | DocumentDoneUpdateParameters |
[Number]
DocumentWithSegments uploadDocument(name, projectId, body, opts)
Upload a File
Create a Document from a file in any of the formats documented in our knowledge base. Request parameters should be passed as JSON object with the header field `LILT-API`. File names in the header can only contain US-ASCII characters. File names with characters outside of US-ASCII should be URI encoded or transliterated to US-ASCII strings. Example CURL command: ``` curl -X POST https://lilt.com/2/documents/files?key=API_KEY \ –header \"LILT-API: {\\"name\\": \\"introduction.xliff\\",\\"pretranslate\\": \\"tm+mt\\",\\"project_id\\": 9}\" \ –header \"Content-Type: application/octet-stream\" \ –data-binary @Introduction.xliff ```
import LiltNode from 'lilt-node';
let defaultClient = LiltNode.ApiClient.instance;
// Configure API key authorization: ApiKeyAuth
let ApiKeyAuth = defaultClient.authentications['ApiKeyAuth'];
ApiKeyAuth.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKeyAuth.apiKeyPrefix = 'Token';
// Configure HTTP basic authorization: BasicAuth
let BasicAuth = defaultClient.authentications['BasicAuth'];
BasicAuth.username = 'YOUR USERNAME';
BasicAuth.password = 'YOUR PASSWORD';
let apiInstance = new LiltNode.DocumentsApi();
let name = "name_example"; // String | A file name.
let projectId = 56; // Number | A unique Project identifier.
let body = "/path/to/file"; // File | The file contents to be uploaded. The entire POST body will be treated as the file.
let opts = {
'pretranslate': "pretranslate_example", // String | An optional parameter indicating if and how the document will be pretranslated upon being uploaded. The accepted values are `TM`, or `TM+MT`
'autoAccept': true, // Boolean | An optional parameter to auto-accept segments with 100% translation memory matches when the `pretranslate` option is also set, or to auto-accept any target data that is present when the uploaded file is XLIFF. If omitted it will default to your organization settings for `Accept and lock exact matches`, if set to `false`, no segments will be auto-accepted.
'caseSensitive': true, // Boolean | An optional parameter to use case sensitive translation memory matching when the `pretranslate` option is also enabled. Matches must have identical character-by-character case to qualify as matches. Default value matches your organization settings for `Use case sensitive translation memory matching` setting
'matchAttribution': true, // Boolean | An optional parameter to attribute translation authorship of exact matches to the author of the file when the `pretranslate` option is also enabled. Default value matches your organization settings for `Translation authorship` setting
'configId': 56 // Number | An optional pararameter to specify an import configuration to be applied when extracting translatable content from this file.
};
apiInstance.uploadDocument(name, projectId, body, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
name | String | A file name. | |
projectId | Number | A unique Project identifier. | |
body | File | The file contents to be uploaded. The entire POST body will be treated as the file. | |
pretranslate | String | An optional parameter indicating if and how the document will be pretranslated upon being uploaded. The accepted values are `TM`, or `TM+MT` | [optional] |
autoAccept | Boolean | An optional parameter to auto-accept segments with 100% translation memory matches when the `pretranslate` option is also set, or to auto-accept any target data that is present when the uploaded file is XLIFF. If omitted it will default to your organization settings for `Accept and lock exact matches`, if set to `false`, no segments will be auto-accepted. | [optional] |
caseSensitive | Boolean | An optional parameter to use case sensitive translation memory matching when the `pretranslate` option is also enabled. Matches must have identical character-by-character case to qualify as matches. Default value matches your organization settings for `Use case sensitive translation memory matching` setting | [optional] |
matchAttribution | Boolean | An optional parameter to attribute translation authorship of exact matches to the author of the file when the `pretranslate` option is also enabled. Default value matches your organization settings for `Translation authorship` setting | [optional] |
configId | Number | An optional pararameter to specify an import configuration to be applied when extracting translatable content from this file. | [optional] |