I want to create a API which can have parameter as multipart file and JSON object (@RequestBody). Please find following snippet while calling this API. I am getting HTTP 415 Uns
An example of a post method which receives a json object and a generic file:
public ResponseEntity postGenerateReport(@RequestPart GenerateReportDTO, generateReportDTO, @RequestPart MultipartFile jxhtmlReport)
For the PostMan setup (or curl or anyother REST test utility) you just have to add form-data request with 2 elements:
Key:generateReportDTO
, Value:
File with .json extension (and compatible content with the object)Key:jxhtmlReport
, Value:
just any file.Gl