文档目录

翻译任务 API

修订译文

POST/v1/translation/updateTexts

为任务中的翻译文本提交修订,可选择重新生成翻译。

完整地址
https://otranslator.com/api/v1/translation/updateTexts
认证
需要在 Authorization 请求头中传入 API Key
Content-Type
application/json
错误格式
{ "error": "Invalid API key." }

注意事项

revisedTexts 会写入任务翻译缓存,用于保存人工修订后的译文。

startTranslation 为 true 时,会在保存修订后重新触发任务处理。

示例

curl
1curl -X POST 'https://otranslator.com/api/v1/translation/updateTexts' \
2--header 'Authorization: [yourSecretKey]' \
3--header 'Content-Type: application/json' \
4--data '{
5  "taskId": "[string]",
6  "revisedTexts": {
7    "key": "value"
8  }
9}'

请求参数

参数类型默认描述示例
*taskIdString-

翻译任务ID

-
*revisedTextsJSON-

已修订的译文

-
startTranslationBooleanfalse

是否重新生成译文

-

响应

参数类型默认描述示例
successBoolean-

是否更新成功

-

常见错误

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: taskId.

Provide the taskId returned by the create translation task API.

404 Task not found.

The task does not exist, has been deleted, does not belong to the current API account, or was not created through the API.

409 Task is processing. Try again after it finishes.

revisedTexts cannot be updated while the task is processing.

翻译任务 API
获取译文
翻译任务 API
重启翻译任务