All Products
Document Center

Machine Translation:Using REST API

Last Updated:Jun 19, 2023

Request Structure

Service Address


Access Address


Request body and return result

The request body is a json structure string, and the service return is also a json string. For details, refer to each API document. Example request (java):

public class SampleRequest {
    public static void main(String[] args) {        
      String serviceURL = "";  
      String accessKeyId = "<yourAccessKeyId>";//  AccessKeyId  
      String accessKeySecret = "<yourAccessKeySecret>"; // accessKeySecret  
      String postBody = "{\n" +  
        " \"FormatType\": \"text\",\n" +  
        " \"SourceLanguage\": \"en\",\n" +  
        " \"TargetLanguage\": \"zh\",\n" +  
        " \"SourceText\": \"Hello\",\n" +  
        " \"Scene\": \"title\"\n" +  
// For the Sender code, please refer to the help document "Signature Method"
String result =  Sender.sendPost(serviceURL, postBody, accessKeyId, accessKeySecret);  

Machine translated version

API version

Access address

General version

E-commerce version

Normal return

Request a normal result as a json string.

Error return


Character Encoding

Both the request and the return result are encoded using the UTF-8 character set.