商品图片智能翻译包含文字识别、文本翻译、文字回填等能力。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String GetImageTranslate

系统规定参数。取值:GetImageTranslate

Url String http://xxxxxxx.oss-cn-shenzhen.aliyuncs.com/xxxxxx.jpg

需要翻译的图片链接

SourceLanguage String zh

图片中的文字语种,

语向支持以及语言代码

TargetLanguage String en

图片中文字翻译后的语种,

语向支持以及语言代码

Extra String {"have_ocr": "false", "without_text":"true", "have_psd": "false", "ignore_entity": "false"}
  • 以下json内容格式,不关注的都可以不用传递,都是可选参数
  • json 格式内容:
    
    {
      "have_ocr": "false",
      "without_text":"true",
      "have_psd": "false",
      "ignore_entity": "false"
    }
    
  • have_ocr 通过true/false 控制是否返回ocr结果,true:需要,false:不需要
  • without_text 控制是否需要擦除图片中的文字,true:需要,false:不需要
  • have_psd 用于图片编辑器,psd数据渲染编辑器
  • ignore_entity 是否忽略实体识别,true:忽略实体识别,false:不忽略

返回数据

名称 类型 示例值 描述
Code Integer 200

状态码,200 表示正常

Message String ok

错误的时候,返回的错误信息

RequestId String A41F6E25-8520-4AF0-90EF-AF7E32840108

请求的唯一串

Data Object

返回的数据内容

Url String https://ae01.alicdn.com/kf/xxxxx.jpeg

翻译后的图片链接

Orc String {"text":"P翼-至草款","width":750,"wordNum":10}

orc 识别后的内容

PictureEditor String {"text":"P翼-至草款","width":750,"wordNum":10}

用于图片编辑器渲染的psd数据

示例

请求示例

http(s)://[Endpoint]/?Action=GetImageTranslate
&Extra={"have_ocr": "false", "without_text":"true", "have_psd": "false", "ignore_entity": "false"}
&SourceLanguage=zh
&TargetLanguage=en
&Url=http://xxxxxxx.oss-cn-shenzhen.aliyuncs.com/xxxxxx.jpg
&<公共请求参数>

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<Message>ok</Message>
<RequestId>A41F6E25-8520-4AF0-90EF-AF7E32840108</RequestId>
<Data>
    <PictureEditor>{"text":"P翼-至草款","width":750,"wordNum":10}</PictureEditor>
    <Orc>{"text":"P翼-至草款","width":750,"wordNum":10}</Orc>
    <Url>https://ae01.alicdn.com/kf/xxxxx.jpeg</Url>
</Data>
<Code>200</Code>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Message" : "ok",
  "RequestId" : "A41F6E25-8520-4AF0-90EF-AF7E32840108",
  "Data" : {
    "PictureEditor" : "{\"text\":\"P翼-至草款\",\"width\":750,\"wordNum\":10}",
    "Orc" : "{\"text\":\"P翼-至草款\",\"width\":750,\"wordNum\":10}",
    "Url" : "https://ae01.alicdn.com/kf/xxxxx.jpeg"
  },
  "Code" : "200"
}

错误码

HttpCode 错误码 错误信息 描述
101 System.RequestTimeOut The request has timed out. 请求超时
102 System.Error A system error occurred. 系统错误
103 System.UrlDecodingError An error occurred while decoding the URL. Verify that the specified URL is encoded. URL编码错误
104 System.ParameterError Some required parameters are missing. 参数错误
105 System.LanguageNotSupported The specified language pair is not supported. 该语向不支持
106 System.LanguageDetectError An error occurred while detecting the language. 语种识别错误
107 System.TranslateError An error occurred while translating. 翻译错误
108 System.StringTooLong The maximum length of the specified string is exceeded. 字符过长
109 System.subNotPermission The sub-account is not authorized to perform the operation. 子账号没有权限
110 System.AccountNotActivated The account has not activated the service. 账号没有开通服务
111 System.SubServiceFailed Sub-account service failed. 子账号服务失败
112 System.TranslateServiceCallFailed Failed to call the translation service. 翻译服务调用失败
113 System.AccountNotActivatedOrInArrears The service is not activated or the account has an outstanding balance. 账号服务没有开通或者欠费
199 System.unknownError An unknown error occurred. 未知错误

访问错误中心查看更多错误码。