翻譯任務 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}'請求參數
| 參數 | 類型 | 預設 | 描述 | 範例 |
|---|---|---|---|---|
| *taskId | String | - | 翻譯任務ID | - |
| *revisedTexts | JSON | - | 已修訂的譯文 | - |
| startTranslation | Boolean | false | 是否重新產生譯文 | - |
響應
| 參數 | 類型 | 預設 | 描述 | 範例 |
|---|---|---|---|---|
| success | Boolean | - | 是否更新成功 | - |
常見錯誤
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.