术语表 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.