✈️ Airline Booking API (Port 8080)
The airline booking service provides flight reservations, passenger management, and loyalty programs.
🧑🤝🧑 Passenger Management
POST
/api/passengers
Create a new passenger account
Request Body:
- first_name (string, required) - Passenger's first name
- last_name (string, required) - Passenger's last name
- email (string, required) - Unique email address
- phone (string, optional) - Phone number
Example Request:
{
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@email.com",
"phone": "+1-555-0123"
}
GET
/api/passengers/{passenger_id}
Get passenger details by ID
GET
/api/passengers
List all passengers
GET
/api/passengers/phone/{phone_number}
Find passenger by phone number
Example:
GET /api/passengers/phone/+1-555-0123
✈️ Flight Management
GET
/api/flights
Search flights with optional filters
Query Parameters:
- origin (string, optional) - Departure city/airport
- destination (string, optional) - Arrival city/airport
- date (string, optional) - Departure date (ISO format)
Example:
GET /api/flights?origin=New York&destination=Los Angeles&date=2025-06-10
GET
/api/flights/{flight_number}
Get specific flight details
POST
/api/flights
Create a new flight
Request Body:
- flight_number (string, required) - Unique flight identifier
- airline (string, required) - Airline name
- origin (string, required) - Departure location
- destination (string, required) - Arrival location
- departure_time (string, required) - ISO datetime
- arrival_time (string, required) - ISO datetime
- price (number, required) - Ticket price
- total_seats (integer, required) - Aircraft capacity
- aircraft_type (string, optional) - Aircraft model
Example Request:
{
"flight_number": "AA999",
"airline": "Cisco Air",
"origin": "Dallas (DFW)",
"destination": "Boston (BOS)",
"departure_time": "2025-06-10T08:00:00",
"arrival_time": "2025-06-10T13:30:00",
"price": 279.99,
"total_seats": 160,
"aircraft_type": "Boeing 737"
}
PUT
/api/flights/{flight_number}
Update flight information
POST
/api/bookings
Create a new booking (automatically awards loyalty points)
Request Body:
- passenger_id (string, required) - Passenger UUID
- flight_number (string, required) - Flight identifier
- seat_number (string, optional) - Preferred seat
Example Request:
{
"passenger_id": "123e4567-e89b-12d3-a456-426614174000",
"flight_number": "AA101",
"seat_number": "12A"
}
GET
/api/bookings/phone/{phone_number}
Find all bookings by phone number (includes passenger details)
Example:
GET /api/bookings/phone/+1-555-0123
Example Response:
{
"passenger": {
"passenger_id": "123e4567-e89b-12d3-a456-426614174000",
"first_name": "John",
"last_name": "Doe",
"email": "john.doe@email.com",
"phone": "+1-555-0123"
},
"bookings": [
{
"booking_id": "987fcdeb-51d2-4a3b-9876-543210987654",
"flight_number": "AA101",
"seat_number": "12A",
"status": "Confirmed"
}
]
}
GET
/api/loyalty/{passenger_id}
Get loyalty points balance and membership tier
Example Response:
{
"passenger_id": "123e4567-e89b-12d3-a456-426614174000",
"name": "John Doe",
"loyalty_points": 15000,
"membership_tier": "Silver",
"points_to_next_tier": 10000
}
🚗 Car Booking API (Port 8081)
The car booking service provides ride-sharing functionality with customer management, ride scheduling, and loyalty programs.
👥 Customer Management
POST
/api/customers
Create a new customer account
Request Body:
- first_name (string, required) - Customer's first name
- last_name (string, required) - Customer's last name
- email (string, required) - Unique email address
- phone (string, optional) - Phone number
GET
/api/customers/{customer_id}
Get customer details by ID
GET
/api/customers
List all customers
GET
/api/customers/phone/{phone_number}
Find customer by phone number
🚙 Ride Management
GET
/api/rides
Search rides with optional filters
Query Parameters:
- pickup (string, optional) - Pickup location
- dropoff (string, optional) - Dropoff location
- date (string, optional) - Ride date (ISO format)
GET
/api/rides/{ride_id}
Get specific ride details
POST
/api/rides
Create a new ride
Request Body:
- ride_id (string, required) - Unique ride identifier
- driver_name (string, required) - Driver name
- pickup_location (string, required) - Pickup location
- dropoff_location (string, required) - Dropoff location
- pickup_time (string, required) - ISO datetime
- estimated_arrival (string, required) - ISO datetime
- price (number, required) - Ride price
- total_seats (integer, required) - Vehicle capacity
- vehicle_type (string, optional) - Vehicle model
🎫 Ride Booking Management
POST
/api/bookings
Create a new ride booking
Request Body:
- customer_id (string, required) - Customer UUID
- ride_id (string, required) - Ride identifier
- seat_number (string, optional) - Preferred seat
GET
/api/bookings/{customer_id}
Get all bookings for a customer
GET
/api/bookings/phone/{phone_number}
Find all ride bookings by phone number
Example Response:
{
"customer": {
"customer_id": "123e4567-e89b-12d3-a456-426614174000",
"first_name": "Jane",
"last_name": "Smith",
"email": "jane.smith@email.com",
"phone": "+1-555-0456"
},
"bookings": [
{
"booking_id": "987fcdeb-51d2-4a3b-9876-543210987654",
"ride_id": "RD001",
"seat_number": "2",
"status": "Confirmed"
}
]
}
🏆 Customer Loyalty Points
GET
/api/loyalty/{customer_id}
Get customer loyalty points and tier status
POST
/api/loyalty/{customer_id}/redeem
Redeem loyalty points for discounts
📊 Response Formats
All API endpoints return JSON responses. Successful requests return status codes 200 (GET) or 201 (POST/PUT). Error responses include appropriate HTTP status codes and error messages in JSON format.
Error Response Example:
{
"error": "Passenger not found"
}