Creating Web APIs with Python and Flask
web-apipythonflaskrestsqlitetutorial
Abstraction: Tutorial building a REST-style web API with Python Flask and SQLite
Key points:
- Introduces HTTP concepts (GET/POST), query parameters, and JSON as the core vocabulary for web APIs
- Step-by-step Flask app construction: routing with
@app.route, returningjsonifyresponses, and error handling with@app.errorhandler(404) - Final version connects to an SQLite database (67 Hugo Award novels, 1953–2014) supporting multi-field filtering by
id,author, andpublishedyear - API design principles covered: plural noun resource paths, versioning (e.g.
/v1/resources/books), avoiding verbs in URLs, and documentation importance - When to use an API vs. a data dump: prefer API when data is large, frequently updated, or users need partial/real-time access
- Lesson produced by Patrick Smyth for Programming Historian (2018)
Connections: Flask · Python · Web API · Rest API · API Design
Source: https://programminghistorian.org/en/lessons/creating-apis-with-python-and-flask