Java 如何使用SpringBoot使用API从Postman生成数据表单post
我只是想让数据表单像Postman一样,我有这样的代码Java 如何使用SpringBoot使用API从Postman生成数据表单post,java,api,spring-boot,postman,Java,Api,Spring Boot,Postman,我只是想让数据表单像Postman一样,我有这样的代码 @PostMapping(value = "/current_location_all") @ResponseBody public JSONObject getCurrentLocationAll(Principal principal) throws Exception { JSONArray list = new JSONArray(); JSONObject obj = new JSONObject(); J
@PostMapping(value = "/current_location_all")
@ResponseBody
public JSONObject getCurrentLocationAll(Principal principal) throws Exception {
JSONArray list = new JSONArray();
JSONObject obj = new JSONObject();
JSONObject obj1 = new JSONObject();
String result = "";
String userName = "santoso215";
UserTBike user = userService.getUserByUsername(userName);
Whitelist wl = whitelistService.getBikeId(userName);
List<TBike> bike = tbikeService.getAllLocation(wl.getBikeId());
for (int i = 0; i < bike.size(); i++) {
obj1.put("bikeID",bike.get(i).getBikeId());
obj1.put("imei",bike.get(i).getBikeImei());
obj1.put("gpsTime",bike.get(i).getGpsLastUpdate());
obj1.put("lo",bike.get(i).getBikeLongitude());
obj1.put("la",bike.get(i).getBikeLatitude());
obj1.put("gps_status",bike.get(i).getBikeGpsStatus());
list.add(obj1);
}
obj.put("success", true);
obj.put("data", list);
return obj;
}
@PostMapping(value=“/current\u location\u all”)
@应答器
公共JSONObject getCurrentLocationAll(主体)引发异常{
JSONArray list=新的JSONArray();
JSONObject obj=新的JSONObject();
JSONObject obj1=新的JSONObject();
字符串结果=”;
字符串userName=“santoso215”;
UserTBike user=userService.getUserByUsername(用户名);
白名单wl=whitelistService.getBikeId(用户名);
List bike=tbikeseservice.getAllLocation(wl.getBikeId());
对于(int i=0;i
但在《邮递员》中,我不会使用表单数据来点击帖子
我如何使用填充值表单(Postman中的表单数据)进行发布。下面给出了可能重复的仅链接答案,通常认为这些答案不足以导致堆栈溢出。如果下面的答案被删除。