How to access json data which is present in payload of angular request in springBoot post API || syncfusion angular calender

Published

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.

Source: Angular Questions

Published
Categorized as angular, java, json, spring-boot, syncfusion-calendar Tagged , , , ,

Answers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq