Module 09 of 12

REST APIs with Django REST Framework

Lessons

About This Module

Not every Django project renders HTML. Mobile apps, single-page front ends, and other services all need data in a machine-readable form, usually JSON served over a REST API. Django REST Framework (DRF) is the standard toolkit for building these APIs on top of the models, views, and authentication you have already learned.

In this module you will learn how serializers convert models to JSON and validate incoming data, how to write API views with DRF's Response objects, and how viewsets and routers generate full CRUD endpoints with very little code. You will also see how API authentication and permissions control who can read or change your data.

Watch the lessons in order, then continue on to Testing & Debugging. Some of these videos were recorded on older Django and DRF releases, so check the official documentation if a detail differs on your install.

Lessons

4 videos
01

Django REST Framework - Serializers & Response Objects

Covers adding REST Framework to a project, creating a ModelSerializer, field-level validation, returning serialized data from a view, the Response object, and the browsable API.

02

Django Rest Framework Full Crash Course - Part 1: Setup, Serializers, ViewSets & Routers

Walks through installing DRF, creating serializers, building a ViewSet, and wiring up URLs with SimpleRouter and DefaultRouter.

03

Django Rest Framework Tutorial: Viewsets, Routers, Serializers, and CRUD

Builds a Django REST API using viewsets, serializers, and routers to provide full CRUD endpoints.

04

Django REST Framework - 2 - Authentication + Permissions

Builds endpoints for user registration, login, and logout, and adds authentication and permissions to protect API access.