術語表 API
建立術語表
POST/v1/glossary/create
建立包含術語和翻譯的新術語表。
- 完整地址
- https://otranslator.com/api/v1/glossary/create
- 認證
- 需要在 Authorization 請求頭中傳入 API Key
- Content-Type
- application/json
- 錯誤格式
- { "error": "Invalid API key." }
注意事項
術語表按當前 API Key 所屬帳號隔離。建立翻譯任務時可透過 glossary 參數傳入術語表名稱。
keys 是源術語列表,translated 是源術語到目標譯文的 JSON 映射。
範例
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}'請求參數
| 參數 | 類型 | 預設 | 描述 | 範例 |
|---|---|---|---|---|
| *name | String | - | 術語表名稱 | 金融術語 |
| desc | String | - | 術語表描述 | - |
| *targetLang | String | - |
| English |
| *keys | String[] | - | 來源術語清單 | ["储蓄分流"] |
| *translated | JSON | - | 源術語到譯文的 JSON 映射 | {"储蓄分流":"Diversion of household deposits"} |
響應
| 參數 | 類型 | 預設 | 描述 | 範例 |
|---|---|---|---|---|
| glossaryId | String | - | 術語表 ID | - |
常見錯誤
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.