REST API built with FastAPI to manage restaurant users and reservations. Data is loaded from CSV files at startup and kept in memory.
- Python 3.10+
- Dependencies listed in
requirements.txt
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtuvicorn main:app --reloadThe API will be available at http://127.0.0.1:8000 and the interactive docs at http://127.0.0.1:8000/docs.
Follow these steps in order. Some steps reuse IDs from earlier responses — replace the placeholder values when you get there.
GET http://127.0.0.1:8000/users
GET http://127.0.0.1:8000/reservations
curl -X POST "http://127.0.0.1:8000/users" \
-H "Content-Type: application/json" \
-d '{
"first_name": "Marcos",
"last_name": "Beliera",
"email": "marcos.beliera@telus.com",
"phone": "22234242433",
"postal_code": "7600",
"age": 30
}'Expected response: the created user, including the generated id. Copy that id — you will need it in step 5.
GET http://127.0.0.1:8000/users/marcos.beliera@telus.com
Replace <user_id> with the id returned in step 3.
curl -X POST "http://127.0.0.1:8000/reservations" \
-H "Content-Type: application/json" \
-d '{
"user_id": "<user_id>",
"number_of_guests": 4,
"occasion": "Birthday",
"reservation_date": "2026-07-01",
"reservation_time": "09:00:00"
}'Copy the reservation id returned — you will need it in steps 8 and 9.
curl -X GET "http://127.0.0.1:8000/reservations/search?reservation_date=2026-07-01"curl -X POST "http://127.0.0.1:8000/reservations" \
-H "Content-Type: application/json" \
-d '{
"user_id": "<user_id>",
"number_of_guests": 4,
"occasion": "Birthday",
"reservation_date": "2026-07-01",
"reservation_time": "09:00:00"
}'Expected response: error — the timeslot is already booked.
Replace <reservation_id> with the reservation id from step 5.
curl -X PATCH "http://127.0.0.1:8000/reservations/<reservation_id>" \
-H "Content-Type: application/json" \
-d '{
"number_of_guests": 10
}'By id:
DELETE http://127.0.0.1:8000/reservations/?reservation_id=<reservation_id>
Or by date and time:
DELETE http://127.0.0.1:8000/reservations/?reservation_date=2026-05-25&reservation_time=18:30:00
GET http://127.0.0.1:8000/users/profile-check?last_name=Stewart
.
├── main.py # Entry point and router registration
├── routers/
│ ├── users.py # User endpoints and model
│ └── reservations.py # Reservation endpoints and model
├── tools/
│ ├── data_import.py # CSV loaders for users and reservations
│ └── validations.py # Shared validators (future date, timeslot conflict)
├── user_data.csv # Initial user data
├── reservation_data.csv # Initial reservation data
└── requirements.txt