curl --request POST \
--url https://api.tolk.every-day.io/v1/imports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form files=@example-file \
--form 'locale=<string>' \
--form 'namespace=<string>' \
--form overwrite=true \
--form createUnknownKeys=true \
--form 'tag=<string>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tolk.every-day.io/v1/imports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"locale\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"namespace\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"overwrite\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"createUnknownKeys\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"tag\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const form = new FormData();
form.append('files', '<string>');
form.append('locale', '<string>');
form.append('namespace', '<string>');
form.append('overwrite', 'true');
form.append('createUnknownKeys', 'true');
form.append('tag', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.tolk.every-day.io/v1/imports', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "import",
"status": "queued",
"progress": {
"done": 123,
"total": 123
},
"result": {},
"error": {
"code": "<string>",
"message": "<string>"
},
"createdAt": "<string>",
"startedAt": "<string>",
"finishedAt": "<string>"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Import files
Uploads translation files (multipart/form-data, files[]: JSON, PHP, PO, MO, CSV, XLSX, XLIFF or a zip of them)
and imports them without a preview, as dialog 10 would after confirming: the format, namespace and language are
recognised from each path unless the request forces them. A file that is refused (unsafe archive, wrong contents
for its extension, too large) is a 422 on files.N and nothing is stored. Otherwise the answer is 202 with
the job and its Location: follow it with GET /v1/jobs/{jobId}. A spreadsheet needs a saved column mapping
(a preset with the same header row); without one the job fails with needs_mapping. A preset without a
language column only creates keys (with createUnknownKeys), and such a spreadsheet cannot be imported together
with translations: the job fails with keys_only_mixed. An import of more than
50.000 lines (keys × languages over all files, TOLK_IMPORT_MAX_LINES) fails with too_many_lines: split it.
curl --request POST \
--url https://api.tolk.every-day.io/v1/imports \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form files=@example-file \
--form 'locale=<string>' \
--form 'namespace=<string>' \
--form overwrite=true \
--form createUnknownKeys=true \
--form 'tag=<string>'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tolk.every-day.io/v1/imports",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"files\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"locale\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"namespace\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"overwrite\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"createUnknownKeys\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"tag\"\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}const form = new FormData();
form.append('files', '<string>');
form.append('locale', '<string>');
form.append('namespace', '<string>');
form.append('overwrite', 'true');
form.append('createUnknownKeys', 'true');
form.append('tag', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.tolk.every-day.io/v1/imports', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"data": {
"id": 123,
"type": "import",
"status": "queued",
"progress": {
"done": 123,
"total": 123
},
"result": {},
"error": {
"code": "<string>",
"message": "<string>"
},
"createdAt": "<string>",
"startedAt": "<string>",
"finishedAt": "<string>"
}
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>",
"errors": {}
}{
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
35The import and export formats with their capabilities: the registry of readers and writers. A new format is a case here, a reader and/or a writer and golden-file tests.
laravel_php, laravel_json, json_js, js_module, po, pot, mo, wordpress_php, wordpress_jed, csv, xlsx, xliff12, xliff20 19150Response
The work is queued as a job: follow it at the Location (GET /v1/jobs/{jobId}).
Show child attributes
Show child attributes