A simple Django REST API for a fictional fitness studio where users can:
- View available fitness classes
- Book a class
- View their bookings
- Clone the project
git clone https://github.com/JeslinMariumAlex/Fitness-Studio-Booking-API.git
cd Fitness-Studio-Booking-API- Create and activate a virtual environment
python3 -m venv env
source env/bin/activate- Install the required packages
pip install -r requirements.txt- Run database migrations
python3 manage.py migrate- Load sample data
python3 manage.py loaddata studio/fixtures.json- Run the development server
python3 manage.py runserver - Get all fitness classes
Endpoint:
GET /api/classes/Sample cURL:
curl http://127.0.0.1:8000/api/classes/2.Book a fitness class
Endpoint:
POST /api/book/Request Body (JSON):
{
"class_id": 1,
"client_name": "Jeslin",
"client_email": "jeslin@example.com"
}
Sample cURL:
curl -X POST http://127.0.0.1:8000/api/book/ \
-H "Content-Type: application/json" \
-d '{"class_id": 1, "client_name": "Jeslin", "client_email": "jeslin@example.com"}'3.View your bookings by email
Endpoint:
GET /api/bookings/?email=jeslin@example.comSample cURL:
curl http://127.0.0.1:8000/api/bookings/?email=jeslin@example.comSeed data is located in:
studio/fixtures.json-
Python
-
Django
-
Django REST Framework
-
SQLite (Default)
Jeslin Marium Alex
🎥 Watch the video demo here: https://www.loom.com/share/bca0259b919c42a7acde9b563cb54723?sid=c1bd58a3-40ac-4642-adca-82f9c974673f