Skip to content

PRO TIP Block youtube.com at the DNS level β€” Pi-hole, NextDNS or your hosts file β€” but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

Python Backend #2: Build a Simple REST API with Flask (GET & POST Tutorial)

2.1K views on YouTube

🎯 Python Web Backend Series (Part 2/6)
Previous Project file https://github.com/NDCSwift/Swift-Projects/raw/refs/heads/main/Python-Projects/PythonBackEnd1_app.py.zip
Now that your Flask server is running, let’s turn it into a real API! In this video, we’ll create GET and POST routes and learn how to return and accept structured JSON data using Flask.
Postman:
{
“name”: “Headphones”,
“price”: 79.99
}

Curl:
curl -X POST http://127.0.0.1:5000/products \
-H “Content-Type: application/json” \
-d ‘{“name”: “Headphones”, “price”: 99.99}’

Test Your API With:
Postman: https://www.postman.com/
VS Code REST Client Extension (optional)

🧠 What You’ll Learn:
βœ… How to define routes using Flask decorators
βœ… Returning JSON using jsonify()
βœ… Accepting POST data with request.get_json()
βœ… Using status codes (e.g., 201 Created)
βœ… Testing with Postman or cURL

πŸ”₯ Download My Project Files
πŸ‘‰ Get the source code here:
πŸ”— https://ndcswift.github.io/Swift-Projects/

⏱️ Timestamps:
00:00 – Intro & Recap
00:10 – What we’re building
00:40 – Creating a GET route
01:33 – Adding products
03:06 – Refactoring code + Testing Products
04:20 – Creating a POST route
06:45 – Code 201
07:35 – importing requests
07:51 – Testing Our Program with Curl
10:11 – Testing Our Program with Postman
11:47 – Bonus: Viewing the changes on our webserver
13:35 – Wrap up + what’s next