if (sessionToken != null) {
filePost.getParams().setCookiePolicy(CookiePolicy.IGNORE_COOKIES);
filePost.setRequestHeader("Cookie", sessionToken.getCookie());
partList.add(new StringPart("apiId", sessionToken.getApiId()));
}
try {
partList.add(new FilePart(fileParamName, file));
} catch (FileNotFoundException e) {
throw new AzwulApiException(e);
}
for (String paramName : paramsMap.keySet()) {
partList.add(new StringPart(paramName, paramsMap.get(paramName)));
}
filePost.setRequestEntity(new MultipartRequestEntity(partList
.toArray(new Part[0]), filePost.getParams()));