Lilt API Binding for Javascript
All URIs are relative to https://api.lilt.com
Method | HTTP request | Description |
---|---|---|
addLabel | POST /v2/files/labels | Add Label to File |
deleteFile | DELETE /v2/files | Delete a File |
download | GET /v2/files/download | Download file |
getFiles | GET /v2/files | Retrieve a File |
removeLabel | DELETE /v2/files/labels | Remove Label from File |
uploadFile | POST /v2/files | Upload a File |
addLabel(id, name)
Add Label to File
Add a label to a File. Example CURL: ```bash curl -X POST 'https://api.lilt.com/v2/files/labels?key=API_KEY&id=1' –header 'Content-Type: application/json' \ –data-raw '{ \"name\": \"label_name\" }' ```
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.FilesApi();
let id = "id_example"; // String | A File id.
let name = new LiltNode.AddFileLabelRequest(); // AddFileLabelRequest |
apiInstance.addLabel(id, name).then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | String | A File id. | |
name | AddFileLabelRequest |
null (empty response body)
FileDeleteResponse deleteFile(id)
Delete a File
Delete a File. Example CURL command: ```bash curl -X DELETE https://api.lilt.com/v2/files?key=API_KEY&id=123 ```
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.FilesApi();
let id = 56; // Number | A unique File identifier.
apiInstance.deleteFile(id).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | A unique File identifier. |
Blob download(id)
Download file
Download a File. Example CURL: ```bash curl -X GET 'https://api.lilt.com/v2/files/download?key=API_KEY&id=1' ```
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.FilesApi();
let id = "id_example"; // String | A File id.
apiInstance.download(id).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | String | A File id. |
Blob
[SourceFile] getFiles(opts)
Retrieve a File
Retrieves one or more files available to your user. Files are not associated with a project or a memory. They are unprocessed and can be used later in the project/document creation workflow step. To retrieve a specific file, specify the <strong>id</strong> request parameter. To retrieve all files, omit the <strong>id</strong> request parameter. Example CURL command: ```bash curl -X GET https://api.lilt.com/v2/files?key=API_KEY&id=274 ```
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.FilesApi();
let opts = {
'id': 56, // Number | A unique File identifier.
'labels': ["null"] // [String] | One or more labels. This will return the files which contain all of the given labels.
};
apiInstance.getFiles(opts).then((data) => {
console.log('API called successfully. Returned data: ' + data);
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | Number | A unique File identifier. | [optional] |
labels | [String] | One or more labels. This will return the files which contain all of the given labels. | [optional] |
removeLabel(id, name)
Remove Label from File
Remove a label from a File. Example CURL: ```bash curl -X DELETE 'https://api.lilt.com/v2/files/labels?key=API_KEY&id=1&name=label_name' ```
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.FilesApi();
let id = "id_example"; // String | A File id.
let name = "name_example"; // String | A label name.
apiInstance.removeLabel(id, name).then(() => {
console.log('API called successfully.');
}, (error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
id | String | A File id. | |
name | String | A label name. |
null (empty response body)
SourceFile uploadFile(name, body, opts)
Upload a File
Upload a File in any of the formats documented in our knowledge base. Request parameters should be passed in as query string parameters. Example CURL command: ```bash curl -X POST https://api.lilt.com/v2/files?key=API_KEY&name=en_US.json \ –header \"Content-Type: application/octet-stream\" \ –data-binary @en_US.json ``` Calls to GET /files are used to monitor the language detection results. The API response will be augmented to include detected language and confidence score. The language detection will complete asynchronously. Prior to completion, the `detected_lang` value will be `zxx`, the reserved ISO 639-2 code for \"No linguistic content/not applicable\". If the language can not be determined, or the detection process fails, the `detected_lang` field will return `und`, the reserved ISO 639-2 code for undetermined language, and the `detected_lang_confidence` score will be `0`.
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.FilesApi();
let name = "name_example"; // String | A file name.
let body = "/path/to/file"; // File | The file contents to be uploaded. The entire POST body will be treated as the file.
let opts = {
'fileHash': "fileHash_example", // String | A hash value to associate with the file. The MD5 hash of the body contents will be used by default if a value isn't provided.
'langId': true, // Boolean | Flag indicating whether to perform language detection on the uploaded file. Default is false.
'projectId': 56, // Number | The project to associate the uploaded file with.
'category': "category_example", // String | The category of the file. The options are `REFERENCE`, or `API`. The default is API. Files with the `REFERENCE` category will be displayed as reference material.
'labels': "labels_example" // String | Comma-separated list of labels to add to the uploaded document.
};
apiInstance.uploadFile(name, 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. | |
body | File | The file contents to be uploaded. The entire POST body will be treated as the file. | |
fileHash | String | A hash value to associate with the file. The MD5 hash of the body contents will be used by default if a value isn't provided. | [optional] |
langId | Boolean | Flag indicating whether to perform language detection on the uploaded file. Default is false. | [optional] |
projectId | Number | The project to associate the uploaded file with. | [optional] |
category | String | The category of the file. The options are `REFERENCE`, or `API`. The default is API. Files with the `REFERENCE` category will be displayed as reference material. | [optional] |
labels | String | Comma-separated list of labels to add to the uploaded document. | [optional] |