目前该API接口已标记为弃用,推荐使用替代API:alimt(2018-10-12) - Translate。
调用机器翻译专业版获取翻译结果。
接口说明
1、字符长度限制 5000,调用接口 QPS 限制 50;如有扩展需求,请与我们联系钉钉群号:23369411
2、请确保在使用该接口前,已充分了解专业版翻译产品的收费方式和价格
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
当前API暂无授权信息透出。
请求参数
名称 | 类型 | 必填 | 描述 | 示例值 |
---|---|---|---|---|
FormatType | string | 是 | 翻译文本的格式,html( 网页格式。设置此参数将对待翻译文本以及翻译后文本按照 html 格式进行处理)、text(文本格式。设置此参数将对传入待翻译文本以及翻译后结果不做文本格式处理,统一按纯文本格式处理。 | text |
TargetLanguage | string | 是 | 目标语种,支持的语种参考。 | zh |
SourceLanguage | string | 是 | 原文语言参考语言 code | en |
SourceText | string | 是 | 待翻译内容 | Hello |
Scene | string | 是 | 场景可选取值:商品标题(title),商品描述(description),商品沟通(communication),医疗(medical),社交(social),金融(finance) | social |
Context | string | 否 | context 信息 | context信息 |
返回参数
示例
正常返回示例
JSON
格式
{
"Code": 200,
"Message": "An error occurred while translating.",
"RequestId": "CC93BB5C-EAB5-579B-AA44-F61528F48FF8",
"Data": {
"Translated": "你好",
"WordCount": "10",
"DetectedLanguage": ""
}
}
错误码
HTTP status code | 错误码 | 错误信息 | 描述 |
---|---|---|---|
101 | 10001 | The request has timed out. | 请求超时 |
102 | 10002 | A system error occurred. | 系统错误 |
103 | 10003 | An error occurred while decoding the URL. Verify that the specified URL is encoded. | 原文解码失败,请检查原文是否UrlEncode |
104 | 10004 | Some required parameters are missing. | 参数缺失 |
105 | 10005 | The specified language pair is not supported. | 语项不支持 |
106 | 10006 | An error occurred while detecting the language. | 语种识别失败 |
107 | 10007 | An error occurred while translating. | 翻译失败 |
108 | 10008 | The specified string is too long. | 字符长度过长 |
109 | 10009 | 子账号没有权限 | - |
110 | 10010 | 账号没有开通服务 | - |
111 | 10011 | 子账号服务失败 | - |
112 | 10012 | 翻译服务调用失败 | - |
113 | 10013 | 账号服务没有开通或者欠费 | - |
199 | 19999 | An unknown error occurred. | 未知异常 |
访问错误中心查看更多错误码。
变更历史
变更时间 | 变更内容概要 | 操作 | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2023-12-06 | OpenAPI 错误码发生变更、OpenAPI 返回结构发生变更 | 看变更集 | ||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||
2023-05-17 | OpenAPI 变更为 deprecated,即将下线、OpenAPI 错误码发生变更 | 看变更集 | ||||||||||||||||||||||||||||||||
|