From the course: Building RESTful Web APIs with Django

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Connecting an UpdateAPIView to the router

Connecting an UpdateAPIView to the router

From the course: Building RESTful Web APIs with Django

Start my 1-month free trial

Connecting an UpdateAPIView to the router

- [Instructor] We refactored the destroy API view and now we have to update the URL configuration to reflect the refactoring. In our URL patterns configuration, we are going to remove the destroy API view and replace it with the retrieve update destroy API view. First we replace the view and we update the URL and that's it. Now let's see how this looks in the browser. Go to one product and retrieve its data. As you can see, we have retrieve, update, and destroy. Let's try changing the name. So we renamed the product and we can also change the price. And now let's delete this product. As you can see, we use Django REST framework's built in views, to make implementing common REST API operations very quick and easy to do.

Contents