Getting the below data in the payload tab of my browser while sending post requests.

"--batch_8c82e185-cbdf-4d70-a62d-a48c9e869bf8 Content-Type: application/http; msgtype=request

POST /api/null HTTP/1.1 Content-Type: application/json; charset=utf-8 Host: localhost:4200

{"Subject":"ankita","StartTime":"2021-11-29T04:00:00.000Z","EndTime":"2021-11-29T04:30:00.000Z","IsAllDay":false,"StartTimezone":null,"EndTimezone":null,"RecurrenceRule":null,"Id":4} --batch_8c82e185-cbdf-4d70-a62d-a48c9e869bf8--"

enter image description here

Note: I am using a third-party library(syncfusion calendar) where I can't customize my request in the body part with JSON.

I am only concerned with the above JSON data.

I want to access this data in the post API method(addAppointment) in spring boot. consider the below code for the controller:

@RequestMapping(value = "/appointment/{batch}" , method = RequestMethod.POST)
public ResponseEntity<?> addAppointment(@PathVariable Map batch,HttpServletRequest request) throws IOException {

/* code required to access that payload JSON data*/

}

what line of code is required to access that JSON data? Please help.

0

There are 0 best solutions below