Dear members, due to maintenance work, the RWS Community might be down tomorrow, Wednesday, 06.07.2022, from 05:30 AM CET to 06:30 AM CET. We thank you for your time and understanding throughout the process.

Translate File SDL Language Cloud REST API

Hi!

I'm unable to use https://lc-api.sdl.com/file-translations API in a Java environment.

This is my source:

HttpEntity entity = MultipartEntityBuilder
.create()
.addTextBody("from", "ita")
.addTextBody("to", "eng")
.addBinaryBody("file", file, ContentType.create("application/octet-stream"), filename)
.build();

HttpPost httpPost = new HttpPost(urlStr);
httpPost.setEntity(entity);

httpPost.addHeader("content-type", "multipart/form-data");
httpPost.addHeader("authorization", "LC apiKey=myKey");
httpPost.addHeader("termbaseIds", "[myTermbase]");

HttpClient httpClient = HttpClientBuilder.create().build();
HttpResponse response = null;

try {
response = httpClient.execute(httpPost);
} catch (IOException e) {
e.printStackTrace();
}
if (response != null){
return EntityUtils.toString(response.getEntity());
}
else{
return null;
}

 

When run the code, server reply:

{"message":"An error occured while processing your request!","errorCode":"GENERIC_APPLICATION_EXCEPTION","details":[]}

Wrong something?

 

UPDATE 18-6-17:

The getStatusLine() method return 500 Internal Server Error.

 

Thanks for the reply!

Alessandro

Parents Reply Children
No Data