0

I just want to make data form post like from Postman, I have code like this

@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;
}

but in Postman I'm not use form data to hit post.

It's not fill value from postman

How can I post with fill the value form (form-data in Postman).

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    Possible duplicate of [How are parameters sent in an HTTP POST request?](https://stackoverflow.com/questions/14551194/how-are-parameters-sent-in-an-http-post-request) – drum Jul 13 '18 at 02:51
  • A link-only answer was given below, and they are generally not considered to be sufficiently substantive for Stack Overflow. [It is preserved here](https://www.getpostman.com/docs/v6/postman/sending_api_requests/requests) in case the answer below is deleted. – halfer May 25 '19 at 10:55

0 Answers0