From the course: Full Stack Web Development with Flask

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Updating data using PUT

Updating data using PUT

- [Instructor] Updating data using PUT. In this video, we're going to create the API to handle the HTTP PUT requests. Now PUT is one of the HTTP verbs used for the REST API CRUD operations, as you see in this table here. PUT is to update or replace existing data and it takes this API slash forward, with it ID resource URL. So let's go and create this operation in the code. So, in the Visual Studio Code, we'll open the routes.py file. And last time we created this get in here. So, it takes the API slash id route. And not the one with the empty. So, maybe we should put in the right place. Otherwise, it may not work as expected. So, I am going to put here a comment to put. Okay, so here we going to create a function called put, takes the self and idx for the index. Now you may think that's maybe complicated. In the relational database system ad world you have to, you know, get the right field, make sure which field is…

Contents