Skip to content

Latest commit

 

History

History
525 lines (359 loc) · 18.6 KB

MemoriesApi.md

File metadata and controls

525 lines (359 loc) · 18.6 KB

LiltNode.MemoriesApi

All URIs are relative to https://api.lilt.com

Method HTTP request Description
createMemory POST /v2/memories Create a Memory
deleteMemory DELETE /v2/memories Delete a Memory
deleteSegmentFromMemory DELETE /v2/memories/segment Delete a segment from a memory.
downloadTermbase GET /v2/memories/termbase/download Termbase download for a Memory
exportTermbase POST /v2/memories/termbase/export Termbase export for a Memory
getMemory GET /v2/memories Retrieve a Memory
importMemoryFile POST /v2/memories/import File import for a Memory
queryMemory GET /v2/memories/query Query a Memory
updateMemory PUT /v2/memories Update the name of a Memory

createMemory

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=&quot;https://support.lilt.com/hc/en-us/sections/360012579193-Lilt-Translate-Engine\" target=_blank>Refer to our KB</a> for a more detailed description.

Example

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);
});

Parameters

Name Type Description Notes
body MemoryCreateParameters

Return type

Memory

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/octet-stream, text/plain

deleteMemory

MemoryDeleteResponse deleteMemory(id)

Delete a Memory

Delete a Memory.

Example

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);
});

Parameters

Name Type Description Notes
id Number A unique Memory identifier.

Return type

MemoryDeleteResponse

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/octet-stream, text/plain

deleteSegmentFromMemory

DeleteSegmentFromMemoryResponse deleteSegmentFromMemory(id, segmentId)

Delete a segment from a memory.

Delete a segment from a memory. ```bash curl -X DELETE https://api.lilt.com/v2/memories/segment?key&#x3D;API_KEY&amp;id&#x3D;ID&amp;segment_id&#x3D;$SEGMENT_ID ```

Example

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 segmentId = 56; // Number | A unique Segment identifier.
apiInstance.deleteSegmentFromMemory(id, segmentId).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number A unique Memory identifier.
segmentId Number A unique Segment identifier.

Return type

DeleteSegmentFromMemoryResponse

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/octet-stream, text/plain

downloadTermbase

Blob downloadTermbase(id)

Termbase download for a Memory

Downloads the termbase export for the given memory as a CSV file. Ensure you first call the `/2/memories/termbase/export` endpoint to start the export process before you try to download it. ```bash curl -X GET https://api.lilt.com/v2/memories/termbase/download?key&#x3D;API_KEY&amp;id&#x3D;ID ```

Example

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.downloadTermbase(id).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number A unique Memory identifier.

Return type

Blob

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/octet-stream, text/plain

exportTermbase

TermbaseExportResponse exportTermbase(id)

Termbase export for a Memory

Exports the termbase entries for the given memory into a CSV file. Calling this endpoint will begin the export process in the background. Check that the processing is complete by polling the `GET /2/memories` endpoint. When the `is_processing` value is 0 then call the `POST /2/memories/termbase/download` endpoint. ```bash curl -X POST https://api.lilt.com/v2/memories/termbase/export?key&#x3D;API_KEY&amp;id&#x3D;ID ```

Example

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.exportTermbase(id).then((data) => {
  console.log('API called successfully. Returned data: ' + data);
}, (error) => {
  console.error(error);
});

Parameters

Name Type Description Notes
id Number A unique Memory identifier.

Return type

TermbaseExportResponse

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/octet-stream, text/plain

getMemory

[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).

Example

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);
});

Parameters

Name Type Description Notes
id Number An optional Memory identifier. [optional]

Return type

[Memory]

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/octet-stream, text/plain

importMemoryFile

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`, `.sdlxliff`(With custom Filters), '.xliff', 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: ```bash curl -X POST https://api.lilt.com/v2/memories/import?key&#x3D;API_KEY \ --header &quot;LILT-API: {\&quot;name\&quot;: \&quot;my_memory.sdltm\&quot;,\&quot;memory_id\&quot;: 42}&quot; \ --header &quot;Content-Type: application/octet-stream&quot; \ --data-binary @my_memory.sdltm ``` Example CURL command to upload a translation memory file named `my_memory.sdlxliff` in the current working directory, with Custom Filters based on SDLXLIFF fields, conf_name which maps to, percentage, and whether we should ignore unlocked segments. ```bash curl -X POST https://api.lilt.com/v2/memories/import?key&#x3D;API_KEY \ --header &quot;LILT-API: {\&quot;name\&quot;: \&quot;my_memory.sdlxliff\&quot;,\&quot;memory_id\&quot;: 12,\&quot;sdlxliff_filters\&quot;:[{\&quot;conf_name\&quot;: \&quot;Translated\&quot;, \&quot;percentage\&quot;: 100, \&quot;allow_unlocked\&quot;: false}]&quot;}&quot; \ --header &quot;Content-Type: application/octet-stream&quot; \ --data-binary @my_memory.sdlxliff ```

Example

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 = {
  'sdlxliffFilters': [new LiltNode.SDLXLIFFFilter()], // [SDLXLIFFFilter] | Contains Filter information Unique to SDLXLIFF
  '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);
});

Parameters

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.
sdlxliffFilters [SDLXLIFFFilter] Contains Filter information Unique to SDLXLIFF [optional]
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]

Return type

MemoryImportResponse

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: application/octet-stream
  • Accept: application/json, application/octet-stream, text/plain

queryMemory

[TranslationMemoryEntry] queryMemory(id, query, opts)

Query a Memory

Perform a translation memory query.

Example

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);
});

Parameters

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]

Return type

[TranslationMemoryEntry]

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, application/octet-stream, text/plain

updateMemory

Memory updateMemory(body)

Update the name of a Memory

Update a Memory.

Example

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);
});

Parameters

Name Type Description Notes
body MemoryUpdateParameters

Return type

Memory

Authorization

ApiKeyAuth, BasicAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, application/octet-stream, text/plain