Glossary API
Create glossary
POST/v1/glossary/create
Create a new glossary with terms and translations.
- Complete address
- https://otranslator.com/api/v1/glossary/create
- Authentication
- API Key needs to be passed in the Authorization request header
- Content-Type
- application/json
- Invalid format
- { "error": "Invalid API key." }
Precautions
Glossaries are isolated by the account associated with the current API Key. When creating a translation task, the glossary name can be passed in through the glossary parameter.
keys is the source terminology list, translated is the JSON mapping from source terms to target translations.
Example
curl
1curl -X POST 'https://otranslator.com/api/v1/glossary/create' \
2--header 'Authorization: [yourSecretKey]' \
3--header 'Content-Type: application/json' \
4--data '{
5 "name": "N9aErn",
6 "targetLang": "English",
7 "keys": [
8 "储蓄分流"
9 ],
10 "translated": {
11 "储蓄分流": "Diversion of household deposits"
12 }
13}'Request Parameters
| Parameters | Type | Default | Description | Example |
|---|---|---|---|---|
| *name | String | - | Glossary name | Financial terminology |
| desc | String | - | Glossary description | - |
| *targetLang | String | - |
| English |
| *keys | String[] | - | List of source terms | ["储蓄分流"] |
| *translated | JSON | - | JSON mapping from source terms to translations | {"储蓄分流":"Diversion of household deposits"} |
Response
| Parameters | Type | Default | Description | Example |
|---|---|---|---|---|
| glossaryId | String | - | Glossary ID | - |
Common Errors
401 Missing API key.
The Authorization request header is required.
401 Invalid API key.
The API key does not exist, has been deleted, or is no longer valid.