如何在POSTMAN中将JSON有效负载与多部分文件一起发布?

时间:2015-11-06 06:59:01

标签: json spring rest postman

在我的Spring REST WS代码中:

我正在使用Spring MultiPartFile

@RequestMapping(value = "/create", consumes=MediaType.MULTIPART_FORM_DATA_VALUE, method = RequestMethod.POST)
@ResponseBody
public String uploadFileAndSaveData(@RequestBody Person person, @RequestParam("file") MultipartFile file) throws Exception {
// do something to save the map to db
}

继承我的JSON有效负载:

{
   "firstname":"darell",
   "lastname":"abbott",
   "address":"philippines"
}

邮差有效载荷 Payload

邮递员档案 File

有没有办法放置JSON有效负载,MultiPartFile或文件在邮递员中一起上传,或者REST WebService中的POST方法不允许有效负载与MultiPartFile一起使用。请任何帮助thnx。

0 个答案:

没有答案