This video demonstrates how to include the ability to delete messages from our database via the API.
- View Offline
- [Instructor] Now our API is both read and write capable,…but how do we make it delete?…Luckily, with our approach,…that's easier than you might think.…Let's start by copying our post route.…We select the post route, and we'll just copy it down below.…We will get rid of the stuff inside,…probably not relevant this time.…We do need to make one change.…Instead of matching the post firm,…we want to match the delete firm.…There's one more change we need to make.…The way it's set up now, if we had delete messages,…the way most people look at,…and the way would probably be implemented is that,…if you tried to make this call,…it would delete all the messages.…
Probably not what were going for.…Let's be a little bit more specific.…Instead of deleting all the messages,…let's delete a single message.…By adding that parameter, we are communicating to the API…there should be a messages slash,…and then an ID of some sort.…Let's put it to action.…We'll same message equals message.…Once again, where using Eloquent here,…with the ORM to be able to look up…
This course begins with a simple application specification and builds it one step at a time. Each chapter includes a key concept, with examples from other public APIs, and then shows how to build it yourself with Slim. Learn about URL routing, validating input, and generating response codes and hypermedia payloads. Like any project, the first implementation may be a little messy but don't worry. The last chapter covers refactoring and what it takes to scale and support the API going forward.
- Understanding the project goals
- Setting up the database
- Adding authentication in Slim
- Using cross-framework and authentication middleware
- Creating a read-write API in Slim
- Uploading files via the API
- Adding file security
- Creating payloads and response codes in Slim
- Scaling your API