Build REST APIs with Python and FastAPI
The Build REST APIs with Python and FastAPI training course is for students who have Python experience and desire to build REST APIs with Python. The course starts by covering the essential concepts of REST APIs, the HTTP protocol, and standard data formats such as JSON. Since more REST APIs utilize databases, the class will cover how to use PostgreSQL, SQL Server, or MongoDB (client choice) with Python as part of a REST API. To implement REST APIs, the FastAPI REST API framework is used (this can be swapped with Flask if Flask is preferred). Finally, topics such as security and cloud deployment are covered.
- Understand the benefits and principles of a REST API
- Review the HTTP protocol and learn how it applies to REST APIs
- Explore how to connect to a Postgresql or SQL Server database with Python
- Review Python Web Framework options
- Learn about tools commonly used when developing REST APIs
- Build a REST API using the Python FastAPI REST API framework
All students should be able to comfortably write Python scripts using basic data types, program structures, and the standard Python library.
All students receive comprehensive courseware covering all topics in the course. Courseware is distributed via GitHub in the form of documentations 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 Visual Studio Code on their computers. Also, students will need permission to install Python Packages and Visual Studio Extensions. If students are unable to configure a local environment, a cloud-based environment can be provided.
- Development Environment (Very Quick Overview)
- Configure VS Code for Python development
- Code Reformatting with Black
- Debugging Python Scripts with VS Code
- Quick 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
- Quick Review of Databases
- What is a Database?
- Connecting to a Database
- Query data from a Database
- Modify data in a Database
- Overview of Python Web Frameworks
- Representational State Transfer
- What is REST?
- HTTP Verbs and their use in REST
- 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
- Secure a REST API with JWT
- Configure CORS
- Cloud Deployment
- Microservice Architecture
- REST API Containerization
- Running Server-Less in Azure