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.
POST a new petition
- [Instructor] Let's test the store method to make sure that we can create a new petition. Looking at the php artisan route:list output, we can see that the method will be POST, the URI will be api/petitions, and the action is the store method on the petition's controller. If everything works, we will be able to create a brand new petition using Postman increasing the total number of petitions from 50 to 51. We need to create a new request and I will do that by clicking on the New button. I'll call it POST a petition, save it in the ePetitions collection, and I will choose to POST method from the dropdown. The request URL is exactly the same as the one we used in our GET petitions request from the last video so I'll just copy it over. Sending a POST request is slightly more complicated because we have to create the body of the request ourselves. Switch to the Body tab, click raw, and select JSON. To make it easier, we…
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)
-