Skip to main content

Endpoint

GET /stores/:id/menu
Retrieve all menu items for a specific store. Supports filtering by category and searching by name.

Authentication

No authentication required. This is a public endpoint.

Path parameters

id
string
required
The unique identifier of the store (MongoDB ObjectId)

Query parameters

category
string
Filter menu items by category (exact match)
Search menu items by name (case-insensitive partial match)

Response

success
boolean
required
Indicates if the request was successful
message
string
Error message (only present when success is false)
data
object
Contains the response data (only present when success is true)

Example requests

Get all menu items

curl https://api.campusbite.com/stores/507f1f77bcf86cd799439011/menu

Filter by category

curl "https://api.campusbite.com/stores/507f1f77bcf86cd799439011/menu?category=Beverages"

Search by name

curl "https://api.campusbite.com/stores/507f1f77bcf86cd799439011/menu?search=coffee"

Combine filters

curl "https://api.campusbite.com/stores/507f1f77bcf86cd799439011/menu?category=Beverages&search=iced"

Example responses

Success response

{
  "success": true,
  "data": {
    "menuItems": [
      {
        "id": "507f1f77bcf86cd799439013",
        "_id": "507f1f77bcf86cd799439013",
        "store_id": "507f1f77bcf86cd799439011",
        "storeId": "507f1f77bcf86cd799439011",
        "name": "Cappuccino",
        "description": "Classic Italian coffee with steamed milk foam",
        "price": 45,
        "image_url": "/uploads/menu/cappuccino.jpg",
        "imageUrl": "/uploads/menu/cappuccino.jpg",
        "category": "Beverages",
        "is_available": true,
        "isAvailable": true,
        "created_at": "2024-01-15T10:35:00.000Z",
        "createdAt": "2024-01-15T10:35:00.000Z",
        "updated_at": "2024-01-20T11:20:00.000Z",
        "updatedAt": "2024-01-20T11:20:00.000Z"
      },
      {
        "id": "507f1f77bcf86cd799439014",
        "_id": "507f1f77bcf86cd799439014",
        "store_id": "507f1f77bcf86cd799439011",
        "storeId": "507f1f77bcf86cd799439011",
        "name": "Iced Latte",
        "description": "Refreshing iced coffee with cold milk",
        "price": 55,
        "image_url": "/uploads/menu/iced-latte.jpg",
        "imageUrl": "/uploads/menu/iced-latte.jpg",
        "category": "Beverages",
        "is_available": true,
        "isAvailable": true,
        "created_at": "2024-01-15T10:36:00.000Z",
        "createdAt": "2024-01-15T10:36:00.000Z",
        "updated_at": "2024-01-20T11:20:00.000Z",
        "updatedAt": "2024-01-20T11:20:00.000Z"
      },
      {
        "id": "507f1f77bcf86cd799439015",
        "_id": "507f1f77bcf86cd799439015",
        "store_id": "507f1f77bcf86cd799439011",
        "storeId": "507f1f77bcf86cd799439011",
        "name": "Chocolate Chip Cookie",
        "description": "Freshly baked with premium chocolate chips",
        "price": 30,
        "image_url": "/uploads/menu/cookie.jpg",
        "imageUrl": "/uploads/menu/cookie.jpg",
        "category": "Snacks",
        "is_available": false,
        "isAvailable": false,
        "created_at": "2024-01-15T10:37:00.000Z",
        "createdAt": "2024-01-15T10:37:00.000Z",
        "updated_at": "2024-01-21T09:15:00.000Z",
        "updatedAt": "2024-01-21T09:15:00.000Z"
      }
    ]
  }
}

Error response (store not found)

{
  "success": false,
  "message": "Store not found."
}

Notes

Sorting: Menu items are automatically sorted first by category (alphabetically), then by name (alphabetically) within each category.
Search behavior: The search parameter performs a case-insensitive partial match on the menu item name. For example, searching for “coffee” will match “Iced Coffee”, “Coffee Latte”, etc.
Availability: The endpoint returns all menu items regardless of their is_available status. Client applications should check the is_available or isAvailable field to determine if an item can be ordered.
Empty results: If no menu items match the filters or if the store has no menu items, the endpoint returns an empty array rather than an error.

Build docs developers (and LLMs) love