From the course: Building RESTful APIs in Laravel
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
PATCH (update) a petition
From the course: Building RESTful APIs in Laravel
PATCH (update) a petition
- [Instructor] Let's test the update method of the petitions controller. Create a new request, give it a name, update the petition, and save it in the ePetitions collection. By the way, the way I named the request is just a personal preference. You can choose your own naming convention. When updating a resource, you can choose between the PUT and PATCH HTTP verbs. We spoke about a difference between these two earlier in the course. But even if you are not sure which one to use, you can look at the route list. You can see that Laravel will accept either of them. I'm going to choose PATCH. The request URL will be the same one as the one we used in saving a new petition. We will use the petition variable and add the petition ID at the end. Let's update the petition with ID 20. Updating a resource is similar to creating a new one in Postman. Since we have to create the body of the request ourself. Switch to the body tab,…
Contents
-
-
-
-
-
-
(Locked)
Installing Postman3m 21s
-
(Locked)
GET all petitions2m 43s
-
(Locked)
POST a new petition2m 14s
-
(Locked)
GET (show) a specific petition3m 3s
-
(Locked)
PATCH (update) a petition2m 19s
-
(Locked)
DELETE a petition2m 10s
-
(Locked)
Challenge: Testing APIs with Postman55s
-
(Locked)
Solution: Testing APIs with Postman3m 3s
-
(Locked)
-