Python REST APIs with FastAPI (Overview)

Creating APIs, or application programming interfaces, is an important part of making your software accessible to a broad range of users. In this video course, you’ll learn the main concepts of FastAPI and how to use it to quickly create web APIs that implement best practices by default.

By the end of it, you’ll be able to start creating production-ready web APIs, and you’ll have the understanding needed to go deeper and learn more for your specific use cases.

In this video course, you’ll learn how to:

  • Use path parameters to get a unique URL path per item
  • Receive JSON data in your requests using pydantic
  • Use API best practices, including validation, serialization, and documentation
  • Continue learning about FastAPI for your use cases

If you’d like brush up on some prerequisites or set up your development environment, you can check out:


Sample Code (.zip)

1.1 KB

Course Slides (.pdf)

290.0 KB

00:00 Hello and welcome. The Internet and Web have many purposes. You are viewing this video as part of the Real Python website. And this website has a visual user interface that you can access and interact with.

00:16 But some web applications do not have a user interface. Instead, they merely serve data or perform actions to create and modify data. Such web applications are called APIs, or Application Programming Interfaces.

00:32 Web APIs are useful for making your application’s data accessible to other applications.

00:39 There are many ways to create a Web API with Python. In this course, you will learn about a relative newcomer to the field, FastAPI. If you are a Python developer on a project that does not have a significant investment in Django or another web framework, you should consider using FastAPI instead.

01:00 Before beginning this course, you should know a few things about Python and web development, including how the basics of HTTP work, how a JSON document is structured, and it would help to know about Python virtual environments.

01:16 For this course, I’ll be using Python 3.9. However, versions of Python back to 3.6 are supported as of this recording. I’ll also be using Visual Studio Code as my editor. For Python support inside of VS Code, I’ve installed the Python extension. Finally, I’ll be using a Python package called HTTPie as a command-line application to help test the APIs that we build.

01:44 You don’t have to have the same setup as me to use FastAPI, but if you want to follow along with the course, this is how my development environment is set up and configured.

Become a Member to join the conversation.