String[] contentTypes = {
"multipart/form-data"};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
FormDataMultiPart mp = new FormDataMultiPart();
for (FileForImport fileForImport : files) {
mp.field("visibilitySource", fileForImport.getVisibilitySource(), MediaType.MULTIPART_FORM_DATA_TYPE);
FormDataContentDisposition dispo = FormDataContentDisposition
.name("file")
.fileName(fileForImport.getFileName())
.size(fileForImport.getFile().length())
.build();
FormDataBodyPart bodyPart = new FormDataBodyPart(dispo, fileForImport.getFile(), MediaType.MULTIPART_FORM_DATA_TYPE);
mp.bodyPart(bodyPart);
}
postBody = mp;
try {
String response = apiInvoker.invokeAPI(basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType);