curl --request POST \
--url https://api.lilt.com/v2/files \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/octet-stream' \
--data '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2">
...
</xliff>'import requests
url = "https://api.lilt.com/v2/files"
payload = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n...\n</xliff>"
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/octet-stream"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/octet-stream'
},
body: '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2">\n...\n</xliff>'
};
fetch('https://api.lilt.com/v2/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lilt.com/v2/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n...\n</xliff>",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/octet-stream"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lilt.com/v2/files"
payload := strings.NewReader("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n...\n</xliff>")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lilt.com/v2/files")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/octet-stream")
.body("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n...\n</xliff>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lilt.com/v2/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/octet-stream'
request.body = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n...\n</xliff>"
response = http.request(request)
puts response.read_body{
"id": 46530,
"name": "en_US.json",
"file_hash": "3858f62230ac3c915f300c664312c63f",
"detected_lang": "de",
"detected_lang_confidence": 0.7,
"category": "REFERENCE",
"labels": [],
"created_at": "2019-10-16T22:12:34Z",
"updated_at": "2019-10-16T22:12:34Z"
}"<string>"{
"message": "Internal server error."
}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:
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.
curl --request POST \
--url https://api.lilt.com/v2/files \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/octet-stream' \
--data '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2">
...
</xliff>'import requests
url = "https://api.lilt.com/v2/files"
payload = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n...\n</xliff>"
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/octet-stream"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: 'Basic <encoded-value>',
'Content-Type': 'application/octet-stream'
},
body: '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2">\n...\n</xliff>'
};
fetch('https://api.lilt.com/v2/files', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.lilt.com/v2/files",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n...\n</xliff>",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/octet-stream"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.lilt.com/v2/files"
payload := strings.NewReader("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n...\n</xliff>")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
req.Header.Add("Content-Type", "application/octet-stream")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.lilt.com/v2/files")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/octet-stream")
.body("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n...\n</xliff>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lilt.com/v2/files")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/octet-stream'
request.body = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:1.2\">\n...\n</xliff>"
response = http.request(request)
puts response.read_body{
"id": 46530,
"name": "en_US.json",
"file_hash": "3858f62230ac3c915f300c664312c63f",
"detected_lang": "de",
"detected_lang_confidence": 0.7,
"category": "REFERENCE",
"labels": [],
"created_at": "2019-10-16T22:12:34Z",
"updated_at": "2019-10-16T22:12:34Z"
}"<string>"{
"message": "Internal server error."
}Authorizations
Query Parameters
Body
The file contents to be uploaded. The entire POST body will be treated as the file.
The body is of type file.
Response
A SourceFile object.
A SourceFile is an unprocessed source file that can later be added to a project.
Was this page helpful?

