Glossary API
Create Glossary
POST/v1/glossary/create
Create a new glossary with terms and translations.
- Complete Address
- https://deploy-demo.otranslator.com/api/v1/glossary/create
- Authentication
- API Key needs to be passed in the Authorization request header
- Content-Type
- application/json
- Error Format
- { "error": "Invalid API key." }
Notes
Glossaries are isolated by the account to which the current API Key belongs. When creating a translation task, you can pass in the glossary name through the glossary parameter.
keys is the source terminology list, translated is the JSON mapping from source terminology to target translation.
Example
1curl -X POST 'https://deploy-demo.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 |
|---|---|---|---|---|
| Required: name | String | - | Glossary name | Financial terminology |
| desc | String | - | Glossary Description | - |
| Required: targetLang | String | - |
| English |
| Required: keys | String[] | - | List of source terms | ["储蓄分流"] |
| Required: translated | JSON | - | JSON Mapping from Source Terms to Translation | {"储蓄分流":"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.