Description of common translation interface invocation.
Limits
1. The QPS limit is 50. If you have any expansion requirements, please contact us. DingTalk group number: 21983957
2, please ensure that the use of the interface, has fully understood the universal version translation products charging methods and prices
Debugging
Request parameters
Parameter | Type | Required | Example | Message |
Action | String | Yes | TranslateGeneral | The operation that you want to perform. Value:TranslateGeneral |
FormatType | String | Yes | text | The format of the translated text. html (web page format. Setting this parameter will process the text to be translated and the translated text in html format), text (text format. If you set this parameter, the text to be translated and the translated results will not be text format processed, but will be processed as pure text format. |
Scene | String | Yes | general | The default generic version is:general |
SourceLanguage | String | Yes | zh | Source language Reference language code |
SourceText | String | Yes | Hello | Content to be translated |
TargetLanguage | String | Yes | en | Target language Reference language code |
Response parameters
Parameter | Type | Example | Message |
Code | Integer | 200 | Error codes |
Data | Struct | The response. | |
Translated | String | Hello | The translated string. |
WordCount | String | 10 | Total number of words |
DetectedLanguage | String | zh | zhThe source language code after language identification when the source language is passed into auto |
Message | String | success | The message that is returned. |
RequestId | String | 86D18195-D89C-4C8C-9DC4-5FCE789CE6D5 | The ID of the request. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=TranslateGeneral
&FormatType=text
&Scene=general
&SourceLanguage=en
&SourceText=Hello
&TargetLanguage=zh
&<Common request parameters>
Sample success response
XML
format
<TranslateGeneralResponse>
<RequestId>14E447CA-B93B-4526-ACD7-42AE13CC2AF6</RequestId>
<Data>
<Translated>Hello</Translated>
</Data>
<Code>200</Code>
</TranslateGeneralResponse>
JSON
format
{
"TranslateGeneralResponse": {
"RequestId": "14E447CA-B93B-4526-ACD7-42AE13CC2AF6",
"Data": {
"Translated": "Hello"
},
"Code": 200
}
}
Error codes
HttpCode | Error code | Error message | Remarks |
101 | 10001 | The request has timed out. | The request timed out. |
102 | 10002 | A system error occurred. | System error. |
103 | 10003 | An error occurred while decoding the URL. Verify that the specified URL is encoded. | Failed to decode the original text. Check whether the original text is UrlEncode. |
104 | 10004 | Some required parameters are missing. | The error message returned when the application ID is not specified. |
105 | 10005 | The specified language pair is not supported. | The language item is not supported. |
106 | 10006 | An error occurred while detecting the language. | The error message returned when the system fails to recognize the string. |
107 | 10007 | An error occurred while translating. | The error message returned when the translation fails. |
108 | 10008 | The specified string is too long. | characters in length too long |
199 | 19999 | An unknown error occurred. | An unknown error occurred. |
109 | 10009 | The RAM user has no permissions. | The RAM user has no permissions. |
110 | 10010 | The account does not activate the service. | The account does not activate the service. |
111 | 10011 | Sub-account service failure | Sub-account service failure |
112 | 10012 | Translation service call failed | Translation service call failed |
113 | 10013 | The account service is not activated or the payment is overdue. | The account service is not activated or the payment is overdue. |
For a list of error codes, see Service error codes.