術語表 API
更新術語表
POST/v1/glossary/update
更新術語表詳情或術語。
- 完整地址
- https://otranslator.com/api/v1/glossary/update
- 認證
- 需要在 Authorization 請求頭中傳入 API Key
- Content-Type
- application/json
- 錯誤格式
- { "error": "Invalid API key." }
注意事項
未傳入的欄位會保持原值不變。
如更新 keys,建議同步更新 translated,確保每個源術語都有對應譯文。
範例
curl
1curl -X POST 'https://otranslator.com/api/v1/glossary/update' \
2--header 'Authorization: [yourSecretKey]' \
3--header 'Content-Type: application/json' \
4--data '{
5 "glossaryId": "[string]",
6 "name": "0twXbd",
7 "keys": [
8 "储蓄分流"
9 ],
10 "translated": {
11 "储蓄分流": "Diversion of household deposits"
12 }
13}'請求參數
| 參數 | 類型 | 預設 | 描述 | 範例 |
|---|---|---|---|---|
| *glossaryId | String | - | 術語表ID | - |
| name | String | - | 名稱 | 金融術語2 |
| desc | String | - | 描述 | - |
| targetLang | String | - |
| - |
| keys | String[] | - | 所有術語的陣列 | ["储蓄分流"] |
| translated | JSON | - | 術語對應譯文的Map | {"储蓄分流":"Diversion of household deposits"} |
響應
| 參數 | 類型 | 預設 | 描述 | 範例 |
|---|---|---|---|---|
| glossaryId | String | - | 術語表ID | - |
| name | String | - | 名稱 | - |
| desc | String | - | 描述 | - |
| targetLang | String | - | 目標語言 | - |
| keys | String[] | - | 所有術語的陣列 | - |
| translated | JSON | - | 術語對應譯文的Map | - |
| createdAt | DateTime | - | 術語表的建立時間 | - |
| updatedAt | DateTime | - | 術語表的更新時間 | - |
常見錯誤
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.
400 Missing required parameter: glossaryId.
Provide the glossaryId returned by the create glossary API.
404 Glossary not found.
The glossary does not exist or does not belong to the current API account.