Rest Api Overview
Let's cover the REST API we are to build!
Endpoints
Restaurants
GET /restaurants Search for restaurants with filters
- Query Parameters:
q: Search query stringlatitude&longitude: Location coordinatesradius: Search radius in kmcuisineType: Filter by cuisineminRating: Minimum rating (1-5)page: Page number (default: 1)size: Results per page (1-100, default: 20)
POST /restaurants Create a new restaurant
- Auth required
- Request: Restaurant details including name, cuisine type, address, location, operating hours
GET /restaurants/{restaurantId} Get detailed information about a specific restaurant
PUT /restaurants/{restaurantId} Update restaurant details
- Auth required
Reviews
GET /restaurants/{restaurantId}/reviews Get reviews for a restaurant
- Query Parameters:
- sort:
date,desc,date,asc,rating,desc,rating,asc(default:date,desc) - page: Page number (default:
1) - size: Results per page (
1-50, default:20)
- sort:
POST /restaurants/{restaurantId}/reviews Create a review
- Auth required
- Request: Review content, rating (1-5), optional photo IDs
- Note: Users can only review a restaurant once
PUT /reviews/{reviewId} Update a review
- Auth required
- Restrictions: Can only update within 48 hours of posting
- Request: Updated content, rating, optional photo IDs
Photos
POST /photos Upload a photo
- Auth required
- Content-Type: multipart/form-data
- Fields:
file: Image filecaption: Optional photo caption
Each paginated response includes metadata with:
- current page number
- page size
- total elements
- total pages
Summary
- The REST API allows for managing Restaurants, Reviews and Photos
- The REST API provide a solid base, but may need to be extended during development