Skip to main content

Build REST APIs with Python and FastAPI

Executive Summary

This course equips Python developers to build high-performance REST APIs using FastAPI. Master core concepts like HTTP and JSON, integrate with PostgreSQL or MongoDB, and secure APIs with JWT. Learn to deploy in the cloud, use middleware, and embrace async routes—ideal for developers ready to scale their backend skills fast.

Programming Professionals Collaborating

Description

This FastAPI training course is designed specifically for Python developers who want to build robust, high-performance REST APIs. Beginning with fundamental REST concepts, attendees will explore the HTTP protocol and learn best practices for formatting and working with JSON data. From there, the course dives into database integration—showing how to connect your FastAPI application to PostgreSQL, SQL Server, or MongoDB depending on your project’s requirements—while also noting that Flask can be substituted for FastAPI if preferred. Throughout, FastAPI’s modern features and asynchronous capabilities are emphasized, and the curriculum culminates in essential backend topics such as implementing JWT-based authentication, configuring CORS, and deploying your APIs to cloud environments. By the end of the course, participants will have not only built and tested their own scalable APIs but also secured and deployed them into production-ready clouds.

Objectives

  • Understand the benefits and architectural principles of REST APIs.
  • Review HTTP fundamentals and their application in API development.
  • Learn how to connect Python apps to relational or NoSQL databases.
  • Compare major Python web frameworks like Django, Flask, and FastAPI.
  • Use FastAPI to build, test, and document high-performance REST APIs.
  • Implement modern security features such as JWT authentication and CORS.
  • Deploy REST APIs to the cloud using containers or serverless platforms.

Duration

21 hours of intensive training with live instruction delivered over three or five days to accommodate varied scheduling needs.

Request Information

Course Outline

Development Environment
  • Configure VS Code or PyCharm for Python development
  • Code Linting and Reformatting with Ruff and MyPy
  • Debugging Python Scripts with VS Code or PyCharm
Review of HTTP and URLs
  • What is HTTP?
  • What are HTTP Verbs?
  • What are the parts of a URL?
  • Path Parameters
  • Query String Parameters
  • Common HTTP Headers
  • Common HTTP Status Codes
Review of Databases
  • What is a Database?
  • Database CLI & GUI Clients
  • Database Code Libraries
  • Connecting to a Database
  • Query data from a Database
  • Modify data in a Database
Python Web Frameworks
  • Overview of Django
  • Overview of Flask
  • Overview of FastAPI
Representational State Transfer
  • What is REST?
  • What is a Resource?
  • HTTP Verbs and their use in REST
  • OpenAPI / Swagger
  • JSON
  • REST Clients
Building a REST API with FastAPI
  • Create an Application
  • Define a Hello World Route
  • Configure a Path Parameter
  • Configure a Query String Parameter
  • Reading Request Body
  • Writing a Response Body
  • Handling Cookies
  • Handle Errors
  • Return Specific Status Codes
  • Asynchronous Routes
  • Serving Static Files
Middleware
  • What is Middleware?
  • Using Middleware in FastAPI
  • Examples of Middleware
  • Creating Custom Middleware
  • Process Requests and Responses
  • ASGI Middleware
  • Built-In Middleware
Security
  • How to Secure a REST API
  • Configure CORS
  • Authentication
  • Authorization
  • HTTP Authentication Schemes
  • OAuth2 Authenication Schemes
  • OpenID Connect
  • JSON Web Tokens (JWT)
Cloud Deployment
  • Microservice Architecture
  • REST API Containerization
  • Running Server-Less in Azure

Prerequisites

  • All students should be able to confidently write Python scripts utilizing basic data types, control structures, and the standard Python library.
  • Students should have a basic understanding of HTTP and web development concepts.

Training Materials

All students receive comprehensive courseware covering all topics in the course. Courseware is distributed via GitHub in the form of documentation and extensive code samples. Students practice the topics covered through challenging hands-on lab exercises. Students will need a free, personal GitHub account to access the courseware. Students will need permission to install Python and Editor (Visual Studio Code or PyCharm) on their computers. Also, students will need permission to install Python Packages and Visual Studio Code Extensions. If students are unable to configure a local environment, a cloud-based environment can be provided.