I am a newbie to IBM MobileFirst, I am trying to upload an image using Multipart. Whenever I try to call the API to upload image I get an error in the Postman saying 415 content not found or 500 server error. So I just wanted to know does IBM mobile first java adapter accepts multi-part requests?
I have attached the Java code used , but none of these are working:
1)
@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
public @ResponseBody
String uploadFileHandler(@RequestParam("file") MultipartFile file)
{
return null;
}
tried this also :
@POST @Path("/upload") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) @OAuthSecurity(enabled=false) public ResponseEntity<?> upload(@RequestParam("files") MultipartFile files) { log.info("XXXXXXXXXXXXXXXXXXXX"); return null;
}
-
@POST @Path("/addEmployeeAttachment") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.MULTIPART_FORM_DATA) @OAuthSecurity(enabled=false) public @ResponseBody Map<String, Object> addEmployeeAttachment( @RequestParam(required = false, value = "attachmentFile") MultipartFile attachmentFile) { log.info("xxxxxxxxxx"); return null; }