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