1. Overview
The Little Lemon API provides backend services for menu management and table reservations. It is built using Django REST Framework.
Base URL: https://api.littlelemon.com/restaurant
2. Authentication
The API uses Token-based Authentication.
2.1. Obtain a Token
To access protected endpoints (such as Bookings), you must first obtain an API Token by providing valid user credentials.
Endpoint:POST /api-token-auth/
Request Body:
{
"username": "admin",
"password": "password123"
}Response (200 OK):
{
"token": "9a8b7c6d5e4f3a2b1c..."
}2.2. Use the Token
Include the token in the Authorization header of subsequent requests to protected endpoints.
Header Format:
Authorization: Token 9a8b7c6d5e4f3a2b1c...
3. Resources
3.1. Menu Items
Manage the restaurant’s food and beverage inventory.
Public Access: No authentication required for viewing.
Write Access: Standard create/update operations supported.
3.1.1. List / Create Items
Retrieve all items or create a new one.
Endpoint:GET /menu/POST /menu/
Note: To create a new menu item (POST), input price as a number (float/integer). The API returns price as a string to preserve decimal precision.
Request Body (POST):
{
"title": "happy lemon",
"price": 5.00,
"inventory": 15
}Response (201 Created):
{
"id": 1,
"title": "happy lemon",
"price": "5.00",
"inventory": 15
}3.1.2. Single Item Operations
Retrieve, update, or delete a specific menu item by its ID.
Endpoint:GET /menu/{id}PUT /menu/{id}DELETE /menu/{id}
Parameters:id (integer, required).
3.2. Bookings
Manage table reservations.
IMPORTANT: This is a Protected Endpoint requiring a valid API Token in the header.
3.2.1. API Root
Provides navigation links to booking resources.
Endpoint:GET /booking/
Response:
{
"tables": "https://api.littlelemon.com/restaurant/booking/tables/"
}3.2.2. List / Create Bookings
Retrieve all reservations or book a new table.
Endpoint:GET /booking/tables/POST /booking/tables/
Note: Use ISO 8601 Format for booking_date (YYYY-MM-DDThh:mm:ssZ).
Request Body (POST):
{
"name": "Mr. Lemon",
"no_of_guests": 5,
"booking_date": "2026-02-14T19:00:00"
}Response (201 Created):
{
"id": 1,
"name": "Mr. Lemon",
"no_of_guests": 5,
"booking_date": "2026-02-14T19:00:00Z"
}3.2.3. Single Booking Operations
Update or cancel a specific reservation.
Endpoint:GET /booking/tables/{id}/PUT /booking/tables/{id}/DELETE /booking/tables/{id}/
4. Data Schema
4.1. Menu Model
| Field | Type | Description |
|---|---|---|
| Integer | Primary Key (Auto-generated) |
| String | Name of the dish (Max 255 chars) |
| Decimal | Input: Number |
| Integer | Quantity available |
4.2. Booking Model
| Field | Type | Description |
|---|---|---|
| Integer | Primary Key (Auto-generated) |
| String | Name of the guest |
| Integer | Number of people |
| DateTime | ISO 8601 Format (YYYY-MM-DDThh:mm:ss) |
