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