π£οΈ Week 02 Lecture
REST APIs and Introduction to FastAPI

Last Updated: 26 January 2025, 22:20.
Welcome to Week 02 of DS205, where we will explore how to transition from data exploration to serving data through APIs.
π Session Details
- Date: Monday, 27 January 2025
- Time: 10:00 am - 12:00 pm
- Location: KSW.1.01
π£οΈ Lecture Content
1. Recap of Week 01
- Discuss how easy/difficult it was to explore the ASCOR dataset independently.
- Capture any sources of confusion about Python and pandas that needs to be reviewed in the course (if any is mentioned).
2. Introduction to REST APIs
- What are APIs?
- Definition and purpose.
- Key concepts:
- All the layers (client, server, etc.)
- RESTful design: Resources, endpoints, HTTP methods.
- JSON response structure: Flat vs nested.
- Status codes: 200, 404, 500.
Visual Aids: Diagram showing the structure of RESTful API communication.
3. FastAPI Overview
- Key features: Type hints, automatic validation, async support.
- Code examples:
- A simple "hello world" API.
- Launching a basic FastAPI app with Uvicorn.
- Demonstrating the auto-generated documentation at
/docs
.
4. Building blocks of a simple API
- Endpoints: Define the structure of the API.
- Models: Define the data structure for request and response bodies.
- Routes: Define the URL paths for the endpoints.
5. Designing APIs for ASCOR Data
- If time allows, a brainstorming session on designing an API for the ASCOR dataset.
- Otherwise, group discusses the following API endpoints:
/v1/indicators
: Serve indicators across all countries./v1/country-data
: Return emission trends for a selected country.
- Discuss user technical requirements and potential use cases.
π¬ Lecture Slides
Use keyboard arrows to navigate. Select the slides below or view fullscreen.
Or download the slides directly as a PDF:
π Next Steps
- Gain more knowledge depth by browsing the FastAPI Official Tutorial.
- Access the π» W02 Lab materials to see how we will practice building APIs
π₯ Session Recording
Letβs hope the lecture capture works this time! π€ If there are no issues, Iβll make the lecture recording available on Moodle on the afternoon of the lecture.