> Markdown version of [/videos/564-how-to-make-rest-apis-in-django](https://www.wearedevelopers.com/videos/564-how-to-make-rest-apis-in-django). Every page supports `.md` or `Accept: text/markdown`. Links point to the HTML versions so they work for humans too. Agent guide: [/agents.md](https://www.wearedevelopers.com/agents.md). --- # How to make REST APIs in Django? Are your APIs fragile and full of boilerplate code? Discover how Django REST Framework uses ViewSets and object-level permissions to rapidly construct robust, secure endpoints. - **Speakers:** Kuldeep Pisda - **Event:** WeAreDevelopers LIVE - **Published:** April 18, 2023 - **Duration:** 56:06 - **URL:** https://www.wearedevelopers.com/videos/564-how-to-make-rest-apis-in-django ## Summary Building APIs without a standardized approach quickly leads to fragile, difficult-to-consume interfaces for front-end and mobile clients. This session explores how REST guidelines solve this by providing a unified design language, and demonstrates how Django REST Framework (DRF) allows developers to implement these standard endpoints efficiently. By utilizing DRF, backend engineers avoid reinventing the wheel and significantly reduce API boilerplate code. The tutorial unpacks DRF's core architectural pillars: mapping complex database models to representable JSON utilizing Serializers, centralizing standard CRUD operations within Model ViewSets, and dynamically generating URL endpoints via Routers. These tools abstract away the tedious manual mapping of HTTP methods (GET, POST, PUT, PATCH, DELETE) to individual view functions, accelerating backend delivery. Beyond basic routing, the walkthrough dives into robust security controls, highlighting the critical differences between authentication (verifying identity) and authorization (validating access). A standout insight is the implementation of object-level custom permissions (`has_object_permission`) and dynamic `QuerySet` overriding. By conditionally returning scoped data or completely different serializers based on a user's role—such as a student versus an admin—developers can silently enforce data security without leaking the existence of restricted resources via explicit error codes. **Keywords:** django rest framework, rest api standardization, python backend architecture, django serializers, drf model viewsets, dynamic api routing, json data serialization, http request methods, authentication vs authorization, custom drf permissions, object-level access control, dynamic querysets, endpoint security configuration, api boilerplate reduction ## Chapters 1. **Understanding REST APIs and HTTP request methods** (00:03) — Standardizing endpoint design using HTTP request methods provides consistent access to application resources. 1. **Core components of Django REST framework architecture** (09:01) — Understanding the interactions between serializers, routers, viewsets, and authentication modules simplifies API endpoint creation. 1. **Implementing serializers to convert raw Django models** (14:45) — Utilizing model serializers efficiently transforms database layer objects into standardized JSON representations. 1. **Creating automated endpoints using model viewsets and routers** (20:52) — Combining model viewsets with routers automates the generation of comprehensive route logic without repetitive manual configuration. 1. **Configuring built-in and custom API access permissions** (26:58) — Leveraging built-in permission classes alongside custom object-level access controls protects resources from unauthorized interactions. 1. **Customizing viewsets and responses based on user roles** (37:49) — Overriding default viewset methods allows dynamic adjustment of database queries and response formats based on individual user authorizations. 1. **Customizing the browsable API and writing endpoint tests** (47:31) — Configuring the default browsable interface and writing unit tests ensures reliable endpoint behavior with interactive documentation. 1. **Entering the software industry and optimizing hackathon performance** (51:18) — Building custom open-source boilerplates helps developers overcome time constraints and avoid repetitive failures during technical hackathons. ## Related Moments - [Structuring modular APIs using the Flask-RESTful extension](https://www.wearedevelopers.com/videos/355-devouring-apis-with-python) (from "Devouring APIs with Python") - [Establishing a concrete vision for REST API development](https://www.wearedevelopers.com/videos/100208-rest-api-antipatterns) (from "Rest API Antipatterns") - [Overview of Python client libraries and API frameworks](https://www.wearedevelopers.com/videos/355-devouring-apis-with-python) (from "Devouring APIs with Python") - [Final code walk-through and audience Q&A session](https://www.wearedevelopers.com/videos/831-creating-a-routing-app-with-google-maps-api-from-scratch) (from "Creating a routing app with Google Maps API from scratch") - [Introduction to the fast API web framework](https://www.wearedevelopers.com/videos/462-intro-to-fastapi) (from "Intro to FastAPI") - [Implementing API endpoints with restful modeling languages](https://www.wearedevelopers.com/videos/758-why-make-use-of-an-integration-platform-in-today-s-software-developments-and-infrastructure) (from "Why make use of an integration platform in today's software developments and infrastructure?") ## Related Articles - [The 7 Most Popular Backend Frameworks for Developers](https://www.wearedevelopers.com/magazine/403-the-7-most-popular-backend-frameworks-for-developers) - [MLops – Deploying, Maintaining And Evolving Machine Learning Models in Production](https://www.wearedevelopers.com/magazine/115-mlops-deploying-maintaining-and-evolving-machine-learning-models-in-production) - [Dev Digest 197: Dunning–Kruger Steroids, State of Cloud Security, Puppies > Beer](https://www.wearedevelopers.com/magazine/660-dev-digest-197-dunning-kruger-steroids-state-of-cloud-security-puppies-beer) - [What’s in The box? – Unboxing The DeepFace](https://www.wearedevelopers.com/magazine/117-what-s-in-the-box-unboxing-the-deepface) ## Related Jobs - [Backend Engineer, Python (Web3)](https://www.wearedevelopers.com/jobs/ext/1934515-backend-engineer-python-web3) at **Bitpanda** - [Software Engineer](https://www.wearedevelopers.com/jobs/ext/1304791-software-engineer) at **Bitpanda** - [Senior Software Engineer, Data](https://www.wearedevelopers.com/jobs/48273-senior-software-engineer-data) at **Sportradar Media Services GmbH** - [Senior Backend Engineer, Blockchain (Smart Contracts)](https://www.wearedevelopers.com/jobs/ext/1940851-senior-backend-engineer-blockchain-smart-contracts) at **Bitpanda** - [Senior Data Engineer](https://www.wearedevelopers.com/jobs/ext/1589390-senior-data-engineer) at **Douglas GmbH** - [Principal Software Engineer](https://www.wearedevelopers.com/jobs/ext/146806-principal-software-engineer) at **Twilio**