
Learn to build a rest api with flask, creating, listing, detailing, updating, and deleting tasks in a simple todo api, while using a robust api library to avoid common pitfalls.
Learn to choose the right API library for Flask by weighing data validation, REST API understanding, JSON schema semantics, and documentation generation to build robust REST services.
Set up the virtual environment and install dependencies for a Flask API project by creating the app folder, initializing Poetry, adding Flask, activating the environment, and creating app.py.
Open the project in PyCharm, add the interpreter from the pre-created environment by running which python in the terminal and pasting its path to configure the editor.
Create a simple hello world Flask app by defining a server, decorating a hello route with a view function, and running it with flask run on a development server.
Set up a flask-smorest API with a blueprint architecture, including a todo blueprint with a namespace and URL prefix, enabling data validation, handling URL, query, and path parameters, with documentation.
Configure a Flask API with flask-smorest by creating an API config class to set the title, major version, open API version, and docs paths, then load it into the app.
Create an in-memory list of tasks in a Flask API, with each task having a uuid and a created timestamp, plus a false completed flag. Hardcode a first item.
Implement collection endpoints for a todo API using Flask class-based views, defining get and post on the /todo/tasks route within a blueprint and exposing docs via Swagger UI.
Define marshmallow schemas to validate task data, create a create task model for post payloads, extend for updates with a completed flag, and expose a full read model with id.
validate url query parameters with marshmallow models to allow sorting tasks by enum fields for sort by (task or created) and sort direction (ascending or descending), with defaults.
Define a task model and nested list to implement the /todo/tasks endpoints, returning a task list via get and individual task via post, with in memory data and database persistence.
Sorts an in-memory list of tasks using a lambda key based on task parameters. Enumerations constrain input, manage defaults, and support ascending or descending order while mitigating injection risks.
Implement singleton endpoints for a task resource in Flask using a blueprint, enabling get, put, and delete operations on a specific task ID with 200, 204, or 404 responses.
this lecture demonstrates testing and fixing singleton endpoints in a flask api by creating, retrieving, updating, and deleting tasks, addressing payload order and put versus patch semantics.
Choose a Flask-based rest framework to build robust apis, with built-in data validation, url path and query parameter handling, and documentation using open api and json schema semantics.
Flask is a hugely popular Python web development framework. Tons of websites are built with Flask, and tons of them contain APIs. I've had the privilege to work with many companies building APIs with Flask, I've seen many common errors and anti-patterns, and I've put together a bunch of best practices to avoid them. This course teaches you how to avoid common mistakes when building APIs with Flask and how to do it the right way.
This course is a quick introduction to building APIs with Flask following best practices and principles. If you know some Flask and are hungry to get started building APIs with Flask, this course is for you. And if you don't know Flask, don't worry, we'll begin by implementing a "hello world" application with Flask so that you understand the basics. You'll see that it really is very easy to get started with Flask.
Flask is one of Python's top web development frameworks. We love Flask because it's lightweight, non-opinionated, very intuitive and easy to use. Flask gives us a lot of flexibility on how to structure our applications and how to implement each layer. However, with great flexibility also comes great responsibility, and this is where things often go astray.
That's especially true for APIs. I've seen it myself. You can get going building APIs directly with Flask, returning JSON, parsing and validating request payloads yourself. And before you realise it, you've built your own API framework, just not a very good one.
APIs are deceptively simple, and so it's very tempting to build them without the right tools. Don't do that. In this course, you'll learn to build Flask APIs using Flask-smorest, a great Flask plugin for building REST APIs.