Building REST APIs with Python
Building REST APIs with Python is a course in building REST APIs with the Django REST Framework on PostgreSQL, from endpoint design, serializers, viewsets and routers to JWT authentication, permissions, OpenAPI documentation and automated tests. It suits Python developers and IT teams who already know the basics of Django and need to build APIs for other systems to use.
- Duration12 hours · 2 days
- FormatOnsite / live online
- Next roundOn request
- CertificateIncluded
Course overview
Today's web sites, mobile apps and partner services all talk to each other through REST APIs, so teams that already use Django need to expose their data as APIs that are well designed, secure, documented and testable. The Django REST Framework is the standard tool for the job because it builds directly on Django's models, ORM and user system.
This course takes learners who know the basics of Django through building a production-style REST API on Django 6 and PostgreSQL 18. They start by designing resources and status codes properly, create serializers with validation, and write APIs with APIView, generic views, viewsets and routers. They then add JWT authentication, permissions, filtering and pagination, generate OpenAPI documentation and write tests, and finish by connecting a React front end and running the whole system with Docker Compose. (2 days, 6 hours per day, 12 hours in total, Intermediate level.)
What you’ll gain
- Set up a Django REST Framework project on PostgreSQL with separate development and production settings
- Design REST APIs with the correct resources, HTTP methods and status codes
- Create serializers and validate incoming data
- Write APIs with APIView, generic views, viewsets and routers, and choose the right one for the job
- Authenticate with JWT and set permissions at both API and object level
- Add filtering, search, ordering and pagination, and generate OpenAPI documentation
- Write tests for an API and run the system with Docker Compose
Who this course is for
- Python developers who already use Django and need to build REST APIs
- Backend developers who build APIs for web sites, mobile apps or other systems
- Students, teachers, lecturers and trainers who want to teach API development with Python
- IT staff and system administrators who connect internal systems through APIs
Prerequisites
- Able to write Python, including functions, classes and package management
- Some experience with Django, such as creating a project, models and views
- Basic SQL and database knowledge
- Able to use a terminal on Windows, macOS or Linux, and a laptop that can run Docker Desktop
Curriculum
Course Details
This course is the 2026 edition of Building REST APIs with Python. It runs for 2 days, 6 hours per day (12 hours in total, 09:00-16:00), as lectures with labs. Intermediate level. This edition moves to Django 6 and the current Django REST Framework, manages projects with uv instead of pip and requirements.txt, runs PostgreSQL 18 on Docker, and adds JWT, permissions, throttling, filtering, pagination, OpenAPI
documentation, pytest and Docker Compose, while keeping the original core of serializers, generic views, viewsets, routers and a React front end. It follows on from Basic Python Django; learners who want to build APIs without Django should see Complete REST API Development with FastAPI. Every lab uses open source or free tools. Learners take home a lab guide and the source code of a Bookmark API with its test suite.
Day 1 API Design, Serializers and Viewsets
Section 1: Lab: Setting Up an API Project
- How a REST API server works compared with a site that returns HTML
- Create a project with uv and install Django and the Django REST Framework
- Run PostgreSQL 18 on Docker and connect with psycopg 3
- Separate development and production settings and keep secrets in environment variables
- Lab: a first API project connected to PostgreSQL
Section 2: Designing a Standard REST API
- Resources, URLs and HTTP methods for CRUD
- Choosing status codes that match the result, and a format for error messages
- Endpoint naming, versioning and pagination
- Idempotency and the difference between PUT and PATCH
- Lab: design the Bookmark API before writing any code
Section 3: Lab: Models and Serializers
- Create models and relationships, then run migrations
- Serializer and ModelSerializer, converting data in both directions
- Field-level and object-level validation
- Show related data with nested serializers and related fields
- Lab: Bookmark and Tag serializers tested in the Django shell
Section 4: APIView and Generic Views
- Request, Response and the browsable API of the Django REST Framework
- Write APIs with @api_view and APIView
- GenericAPIView with mixins to reduce repeated code
- ListCreateAPIView and RetrieveUpdateDestroyAPIView
- Lab: an API that lists, creates, updates and deletes bookmarks
Section 5: Lab: Viewsets and Routers
- ModelViewSet, which combines CRUD in one class
- Generate URLs automatically with DefaultRouter
- Add custom endpoints with @action, such as liking a bookmark
- HyperlinkedModelSerializer and links between resources
- Compare each kind of view and choose the right one for the job
Day 2 Security, Documentation, Testing and Deployment
Section 6: Lab: JWT Authentication
- Comparing sessions, tokens and JWT for APIs
- Install Simple JWT and create endpoints to obtain and refresh tokens
- Rotate refresh tokens and revoke tokens on logout
- User registration and a current-user endpoint
- Lab: login for the Bookmark API
Section 7: Permissions and Security
- Built-in permission classes and global settings
- Write object-level permissions so only the owner can edit
- Limit request rates with throttling
- Configure CORS with django-cors-headers and check settings with check --deploy
- Lab: protect the API by user role
Section 8: Lab: Filtering, Search and Pagination
- Filter data with django-filter
- SearchFilter and OrderingFilter
- PageNumberPagination and CursorPagination
- Avoid repeated queries with select_related and prefetch_related
- Lab: search and paginate the bookmark list
Section 9: Lab: OpenAPI Documentation and Testing
- Generate an OpenAPI schema with drf-spectacular and serve Swagger UI and ReDoc
- Describe endpoints further with extend_schema
- Write tests with APIClient, pytest and pytest-django
- Test user permissions and error cases, and measure coverage
- Lab: API documentation and a test suite for the viewset
Section 10: Workshop: Connecting React and Deploying
- A React page that logs in with JWT and calls the Bookmark API
- Run Django with Gunicorn alongside PostgreSQL in Docker Compose
- Static files and production settings
- Use an AI assistant to help write tests and review code, and always check the result yourself
- Next steps towards async views and background tasks
Schedule & training options
For individuals — public rounds
No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770
For organisations — in-house / private
- Tailor the content to your team’s tools and projects
- Your dates, at your office or live online
- Quotation with tax ID for procurement
Instructors
Frequently asked questions
What is a REST API, and how are HTTP methods used?
A REST API serves data over HTTP by treating each kind of data as a resource with its own URL and using the HTTP method to say what to do: GET reads, POST creates, PUT replaces the whole resource, PATCH updates part of it and DELETE removes it. Results are reported with status codes such as 200 for success, 201 for created, 400 for invalid data, 401 for not authenticated, 403 for not permitted and 404 for not found. Data is usually exchanged as JSON.
What are the steps to build an API with the Django REST Framework?
Install djangorestframework and add rest_framework to INSTALLED_APPS. Create your models and run migrations, then write serializers, usually ModelSerializer, to convert and validate data. Write the views; for typical work a ModelViewSet combines CRUD in one class. Register the viewset with DefaultRouter so the URLs are generated for you. Finally set authentication and permissions, and test through the browsable API, Swagger UI or Postman.
How do I separate Django settings between development and production?
The approach used in the course keeps values that differ between environments, such as SECRET_KEY, DEBUG, ALLOWED_HOSTS and database connection details, in environment variables or a .env file that is not committed to Git, and has settings read them from there. Some projects also split settings into base, dev and prod files. In production, turn DEBUG off, configure HTTPS and CORS tightly, and run manage.py check --deploy to catch unsafe settings before going live.
Who is the Building REST APIs with Python course for, and what should I know beforehand?
It suits Python developers who already use Django, backend developers who build APIs for web sites or mobile apps, teachers who teach API development and IT staff who connect internal systems. You should be able to write Python, have used Django for basics such as projects, models and views, and know basic SQL. If you have not used Django before, we recommend taking Basic Python Django first.
What will I be able to do after the Building REST APIs with Python course?
You will be able to design and build REST APIs with the Django REST Framework on PostgreSQL, using serializers, generic views, viewsets and routers, authenticate with JWT, set user permissions, add filtering and pagination, generate OpenAPI documentation, write tests and run the system with Docker Compose. Participants who complete the training receive a Certificate of Completion with its own number, which can be verified online.
Can the Building REST APIs with Python course be run in-house for our team?
Yes. It can be run in-house for your team, with examples adapted to your work, such as building APIs from the models of systems your organisation already uses. You can request a quotation from this page, or contact us on LINE @itgenius or by phone on 02-570-8449.
Related articles
Articles are published in Thai.

