创建文档翻译任务。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
| 名称 | 类型 | 是否必选 | 示例值 | 描述 |
|---|---|---|---|---|
| Action | String | 是 | CreateDocTranslateTask | 系统规定参数。取值:CreateDocTranslateTask。 说明 仅支持通过POST方式调用 |
| SourceLanguage | String | 是 | en | 原文语言,语言code参考 |
| TargetLanguage | String | 是 | zh | 目标语言,语言code参考 |
| FileUrl | String | 是 | http://fileUrl | 文档URL。 |
| Scene | String | 否 | general | 场景,支持:通用(general)、标题(title)、详情(description)、买卖家沟通(message)、医疗(medical)、社交(social)、科技(tech)。 |
| CallbackUrl | String | 否 | http://callbackUrl | 翻译结果回调URL,服务器会向回调地址发起post请求 请求body raw json
IP白名单 59.82.61.52 203.119.241.30 203.119.241.98 59.82.84.90 203.119.241.56 59.82.61.75 回调服务示例:该服务用于回调方式获取翻译结果
|
| ClientToken | String | 否 | token | 提供幂等能力,3分钟内,相同的值只会生效一次。 |
返回数据
| 名称 | 类型 | 示例值 | 描述 |
|---|---|---|---|
| Status | String | ready | 任务状态。 |
| RequestId | String | D3920BC3-A395-4CAD-9E84-7C39EB07507B | 请求ID。 |
| TaskId | String | 0586df512c8b4bb382d7d9a6a01b5854 | 任务ID。 |
示例
请求示例
http(s)://[Endpoint]/?Action=CreateDocTranslateTask
&CallbackUrl=http://callbackUrl
&FileUrl=http://fileUrl
&SourceLanguage=en
&TargetLanguage=zh
&<公共请求参数>
正常返回示例
XML格式
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateDocTranslateTaskResponse>
<requestId>D3920BC3-A395-4CAD-9E84-7C39EB07507B</requestId>
<taskId>0586df512c8b4bb382d7d9a6a01b5854</taskId>
<status>ready</status>
</CreateDocTranslateTaskResponse>
JSON格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"CreateDocTranslateTaskResponse" : {
"requestId" : "D3920BC3-A395-4CAD-9E84-7C39EB07507B",
"taskId" : "0586df512c8b4bb382d7d9a6a01b5854",
"status" : "ready"
}
}
错误码
| HttpCode | 错误码 | 错误信息 | 描述 |
|---|---|---|---|
| 199 | 19999 | An unknown error occurred. | 未知异常 |
| 400 | 10021 | The parameter is invalid. | 参数无效。 |
| 400 | 10022 | The parameter fileUrl is invalid. | 参数fileUrl非法。 |
| 400 | 10023 | The parameter fileUrl is not accessible. | 参数fileUrl无法访问。 |
| 400 | 10024 | The parameter callbackUrl is invalid. | 参数callbackUrl非法。 |
| 400 | 10030 | The file size exceeds the limit. | 文件大小超过了限制。 |
| 400 | 10031 | The specified file type is invalid. | 文件类型不支持。 |
| 400 | InvalidAccountStatus | The Machine Translation service has not been activated. | 用户未开通机器翻译服务。 |
| 403 | 10029 | The number of calls per day exceeds the limit. | 超出单日调用次数限制。 |
访问错误中心查看更多错误码。