Import a TBX, CSV, or XLSX file into a glossary
curl --request POST \
--url https://public-api.hyperlocalise.com/v1/glossaries/{glossaryId}/import \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--form file=@example-file \
--form mode=merge \
--form strictLocale=trueconst form = new FormData();
form.append('file', '<string>');
form.append('mode', 'merge');
form.append('strictLocale', 'true');
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
options.body = form;
fetch('https://public-api.hyperlocalise.com/v1/glossaries/{glossaryId}/import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://public-api.hyperlocalise.com/v1/glossaries/{glossaryId}/import"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"mode": "merge",
"strictLocale": "true"
}
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public-api.hyperlocalise.com/v1/glossaries/{glossaryId}/import"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\nmerge\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"strictLocale\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"import": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"glossaryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"format": "tbx",
"mode": "preview",
"status": "<string>",
"counts": {},
"errorCode": "<string>",
"errorMessage": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"diagnostics": [
{
"severity": "warning",
"code": "<string>",
"message": "<string>",
"conceptId": "<string>",
"termId": "<string>",
"field": "<string>"
}
]
}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Glossaries
Import a TBX, CSV, or XLSX file into a glossary
Requires glossaries:write, which files:write grants to admins, localization managers, and translators. Translators can import only into team-controlled glossaries of their teams. Native glossaries only. The file is processed by the same importer as the web app (TBX 2 and TBX 3, forbidden terms included), so the request returns 202 with a run to poll at .../import-reports/{reportId}. mode defaults to merge; preview reports changes without applying them. At most 25 MB.
POST
https://public-api.hyperlocalise.com
/
v1
/
glossaries
/
{glossaryId}
/
import
Import a TBX, CSV, or XLSX file into a glossary
curl --request POST \
--url https://public-api.hyperlocalise.com/v1/glossaries/{glossaryId}/import \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--form file=@example-file \
--form mode=merge \
--form strictLocale=trueconst form = new FormData();
form.append('file', '<string>');
form.append('mode', 'merge');
form.append('strictLocale', 'true');
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
options.body = form;
fetch('https://public-api.hyperlocalise.com/v1/glossaries/{glossaryId}/import', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://public-api.hyperlocalise.com/v1/glossaries/{glossaryId}/import"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"mode": "merge",
"strictLocale": "true"
}
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public-api.hyperlocalise.com/v1/glossaries/{glossaryId}/import"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"mode\"\r\n\r\nmerge\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"strictLocale\"\r\n\r\ntrue\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"import": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"glossaryId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"format": "tbx",
"mode": "preview",
"status": "<string>",
"counts": {},
"errorCode": "<string>",
"errorMessage": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"completedAt": "2023-11-07T05:31:56Z",
"diagnostics": [
{
"severity": "warning",
"code": "<string>",
"message": "<string>",
"conceptId": "<string>",
"termId": "<string>",
"field": "<string>"
}
]
}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}{
"error": "<string>",
"message": "<string>",
"details": {}
}Body
multipart/form-data
Was this page helpful?

