Lilt API Binding for Javascript
All URIs are relative to https://lilt.com/2
Method | HTTP request | Description |
---|---|---|
createMemory | POST /memories | Create a Memory |
deleteMemory | DELETE /memories | Delete a Memory |
getMemory | GET /memories | Retrieve a Memory |
importMemoryFile | POST /memories/import | File import for a Memory |
queryMemory | GET /memories/query | Query a Memory |
syncDeleteMemory | DELETE /memories/sync | Delete-sync for a Memory |
syncDownMemory | GET /memories/sync | Get-sync for a Memory |
syncInsertMemory | POST /memories/sync | Insert-sync for a Memory |
syncUpdateMemory | PUT /memories/sync | Update-sync for a Memory |
updateMemory | PUT /memories | Update the name of a Memory |
Memory createMemory(body)
Create a Memory
Create a new Memory. A Memory is a container that collects source/target sentences for a specific language pair (e.g., English>French). The data in the Memory is used to train the MT system, populate the TM, and update the lexicon. Memories are private to your account - the data is not shared across users - unless you explicitly share a Memory with your team (via web app only). <a href=\"https://support.lilt.com/hc/en-us/sections/360012579193-Lilt-Translate-Engine\" target=_blank>Refer to our KB</a> for a more detailed description.
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.MemoriesApi();
let body = new LiltNode.MemoryCreateParameters(); // MemoryCreateParameters |
apiInstance.createMemory(body).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
body | MemoryCreateParameters |
MemoryDeleteResponse deleteMemory(id)
Delete a Memory
Delete a Memory.
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.MemoriesApi();
let id = 56; // Number | A unique Memory identifier.
apiInstance.deleteMemory(id).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | A unique Memory identifier. |
[Memory] getMemory(opts)
Retrieve a Memory
Retrieve a Memory. If you cannot access the Memory (401 error) please check permissions (e.g. in case you created the Memory via the web app with a different account you may have to explicitly share that Memory).
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.MemoriesApi();
let opts = {
'id': 56 // Number | An optional Memory identifier.
};
apiInstance.getMemory(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | An optional Memory identifier. | [optional] |
MemoryImportResponse importMemoryFile(memoryId, name, body, opts)
File import for a Memory
Imports common translation memory or termbase file formats to a specific Lilt memory. Currently supported file formats are `.tmx`, `.sdltm` and `.tmq` for TM data; `.csv` and `*.tbx` for termbase data. Request parameters should be passed as JSON object with the header field `LILT-API`. Example CURL command to upload a translation memory file named `my_memory.sdltm` in the current working directory: ``` curl -X POST https://lilt.com/2/memories/import?key=API_KEY \ –header \"LILT-API: {\\"name\\": \\"my_memory.sdltm\\",\\"memory_id\\": 42}\" \ –header \"Content-Type: application/octet-stream\" \ –data-binary @my_memory.sdltm ```
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.MemoriesApi();
let memoryId = 56; // Number | A unique Memory identifier.
let name = "name_example"; // String | Name of the TM or termbase file.
let body = "/path/to/file"; // File | The file contents to be uploaded. The entire POST body will be treated as the file.
let opts = {
'hasHeaderRow': true, // Boolean | A flag indicating whether an imported Termbase CSV has a header row or not (the default value is `false`).
'skipDuplicates': true // Boolean | A flag indicating whether or not to skip the import of segments which already exist in the memory. (the default value is `false`).
};
apiInstance.importMemoryFile(memoryId, name, body, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
memoryId | Number | A unique Memory identifier. | |
name | String | Name of the TM or termbase file. | |
body | File | The file contents to be uploaded. The entire POST body will be treated as the file. | |
hasHeaderRow | Boolean | A flag indicating whether an imported Termbase CSV has a header row or not (the default value is `false`). | [optional] |
skipDuplicates | Boolean | A flag indicating whether or not to skip the import of segments which already exist in the memory. (the default value is `false`). | [optional] |
[TranslationMemoryEntry] queryMemory(id, query, opts)
Query a Memory
Perform a translation memory query.
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.MemoriesApi();
let id = 56; // Number | A unique Memory identifier.
let query = "query_example"; // String | A source query.
let opts = {
'n': 10 // Number | Maximum number of results to return.
};
apiInstance.queryMemory(id, query, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | A unique Memory identifier. | |
query | String | A source query. | |
n | Number | Maximum number of results to return. | [optional] [default to 10] |
MemoryInsertResponse syncDeleteMemory(id, opts)
Delete-sync for a Memory
Deletes segments in the Memory matching the `from_time`, `to_time` and `when` parameters. Example CURL command: ``` curl -X DELETE https://lilt.com/2/memories/sync?key=API_KEY&id=42&from_time=1491048000&to_time=1491049800&when=created ```
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.MemoriesApi();
let id = 56; // Number | A unique Memory identifier.
let opts = {
'fromTime': 56, // Number | Unix time stamp (epoch, in seconds) of the start of the Memory section.
'toTime': 56, // Number | Unix time stamp (epoch, in seconds) of the end of the Memory section.
'when': "when_example" // String | The date field on which retrieved segments match from/to time stamps: `created`, `updated`, `deleted`.
};
apiInstance.syncDeleteMemory(id, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | A unique Memory identifier. | |
fromTime | Number | Unix time stamp (epoch, in seconds) of the start of the Memory section. | [optional] |
toTime | Number | Unix time stamp (epoch, in seconds) of the end of the Memory section. | [optional] |
when | String | The date field on which retrieved segments match from/to time stamps: `created`, `updated`, `deleted`. | [optional] |
Blob syncDownMemory(id, opts)
Get-sync for a Memory
Get all or part of a memory in TMX 1.4b format. If the `from_time` and/or `to_time` are omitted, then all segments are returned. The parameter `when` specifies on which date field `from_time` and `to_time` are matched. Possible values are `created` (when the segment was originally created in the memory), `updated` (when the segment was lastly updated), and `deleted` (when the segment was deleted). Example CURL command: ``` curl -X GET https://lilt.com/2/memories/sync?key=API_KEY&id=42 -o from_lilt.tmx ```
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.MemoriesApi();
let id = 56; // Number | A unique Memory identifier.
let opts = {
'fromTime': 56, // Number | Unix time stamp (epoch, in seconds) of the start of the Memory section.
'toTime': 56, // Number | Unix time stamp (epoch, in seconds) of the end of the Memory section.
'when': "when_example" // String | The date field on which retrieved segments match from/to time stamps: `created`, `updated`, `deleted`. If this parameter is omitted, then the whole Memory is returned.
};
apiInstance.syncDownMemory(id, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | A unique Memory identifier. | |
fromTime | Number | Unix time stamp (epoch, in seconds) of the start of the Memory section. | [optional] |
toTime | Number | Unix time stamp (epoch, in seconds) of the end of the Memory section. | [optional] |
when | String | The date field on which retrieved segments match from/to time stamps: `created`, `updated`, `deleted`. If this parameter is omitted, then the whole Memory is returned. | [optional] |
Blob
MemoryInsertResponse syncInsertMemory(id, body, opts)
Insert-sync for a Memory
Inserts a TM in TMX 1.4b format into the Memory. Request parameters should be passed as JSON object with the header field `LILT-API`. Example CURL command: ``` curl -X POST https://lilt.com/2/memories/sync?key=API_KEY \ –header \"LILT-API: {\\"name\\": \\"my_memory.tmx\\",\\"id\\": 42}\" \ –header \"Content-Type: application/octet-stream\" \ –data-binary @my_memory.tmx ```
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.MemoriesApi();
let id = 56; // Number | A unique Memory identifier.
let body = "body_example"; // String | The file contents to be uploaded. The entire POST body will be treated as the file.
let opts = {
'name': "name_example" // String | Name of the TMX file.
};
apiInstance.syncInsertMemory(id, body, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | A unique Memory identifier. | |
body | String | The file contents to be uploaded. The entire POST body will be treated as the file. | |
name | String | Name of the TMX file. | [optional] |
MemoryUpdateResponse syncUpdateMemory(id, body, opts)
Update-sync for a Memory
Updates the Memory with given TMX file. Request parameters should be passed as JSON object with the header field `LILT-API`. The number of segments returned by the `from_time`, `to_time`, `when` parameters and the number of segments in the TMX file need to be identical. Example CURL command: ``` curl -X PUT https://lilt.com/2/memories/sync?key=API_KEY \ –header \"LILT-API: {\\"name\\": \\"my_memory.tmx\\", \\"id\\": 42, \\"from_time\\": 1491048000, \\"to_time\\": 1491049800, \"when\": \"Updated\"}\" \ –header \"Content-Type: application/octet-stream\" \ –data-binary @my_memory.tmx ```
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.MemoriesApi();
let id = 56; // Number | A unique Memory identifier.
let body = "body_example"; // String | The file contents to be uploaded. The entire PUT body will be treated as the file.
let opts = {
'fromTime': 56, // Number | Unix time stamp (epoch, in seconds) of the start of the Memory section.
'toTime': 56, // Number | Unix time stamp (epoch, in seconds) of the end of the Memory section.
'when': "when_example" // String | The date field on which retrieved segments match from/to time stamps: `created`, `updated`, `deleted`.
};
apiInstance.syncUpdateMemory(id, body, opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | A unique Memory identifier. | |
body | String | The file contents to be uploaded. The entire PUT body will be treated as the file. | |
fromTime | Number | Unix time stamp (epoch, in seconds) of the start of the Memory section. | [optional] |
toTime | Number | Unix time stamp (epoch, in seconds) of the end of the Memory section. | [optional] |
when | String | The date field on which retrieved segments match from/to time stamps: `created`, `updated`, `deleted`. | [optional] |
Memory updateMemory(body)
Update the name of a Memory
Update a Memory.
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.MemoriesApi();
let body = new LiltNode.MemoryUpdateParameters(); // MemoryUpdateParameters |
apiInstance.updateMemory(body).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
body | MemoryUpdateParameters |