From the course: Creating Spring Boot Microservices
Unlock the full course today
Join today to access over 25,000 courses taught by industry experts.
Create the RestController HTTP PUT, PATCH, and DELETE endpoints - Spring Boot Tutorial
From the course: Creating Spring Boot Microservices
Create the RestController HTTP PUT, PATCH, and DELETE endpoints
- [Instructor] Our next task is we're going to do the endpoints for HTTP put and HTTP delete. So now I'm going to do a PutMapping and I'm going to call my method updateWithPut and it will return a RatingDto. And we're passing in a request body. We're going to do the validation as well on that. Gimme a little bit of space there. So we're going to return a new RatingDto, and we're going to invoke the tourRatingService to update the tour rating. So we're invoking this service and then it will return a TourRating entity, which will be used to instantiate a new RatingDto, which will be returned. So that's the end of that method. And now we need DeleteMapping. And what's going to be passed in on the DeleteMapping is a customer ID. So delete any rating for this tour for this customer, the rating that that person has made. I'm going to invoke the service to delete a TourRating by the tourID and the customerID and end that and that does not return anything. Okay, looks good, no compilation…
Contents
-
-
-
-
-
-
- (Locked) Choosing the right framework3m 31s
- Declaring a new RestController6m 29s
- (Locked) Create the RestController HTTP POST endpoint7m 31s
- (Locked) Create the RestController HTTP GET endpoint3m 23s
- (Locked) Create the RestController HTTP PUT, PATCH, and DELETE endpoints3m 34s
- (Locked) Challenge: Add a PATCH endpoint1m 6s
- (Locked) Solution: Add a PATCH endpoint1m 20s
- (Locked)
-
-
-
-
-