メインコンテンツへスキップ

API リファレンス

メニューアイテム API

メニューアイテム API

メニューアイテム API を使用すると、レストランのメニューアイテムを作成、取得、更新、削除できます。すべてのエンドポイントで認証が必要であり、認証済みユーザーのレストランに属するアイテムを対象に動作します。

GET /api/menu-items

レストランのすべてのメニューアイテムを取得します。

認証: 必須 (Bearer トークン)

レスポンス (200 OK)

{
  "success": true,
  "data": [
    {
      "id": "uuid",
      "name": "Margherita Pizza",
      "description": "Classic pizza with fresh mozzarella and basil",
      "price": 14.99,
      "priceCents": 1499,
      "category": "Mains",
      "photoUrl": "https://...",
      "isActive": true,
      "position": 1,
      "createdAt": "2026-02-01T12:00:00Z",
      "updatedAt": "2026-02-01T12:00:00Z"
    }
  ]
}

POST /api/menu-items

新しいメニューアイテムを作成します。写真はアップロードエンドポイントで別途アップロードし、その URL で参照してください。

認証: 必須 (Bearer トークン)

リクエストボディ

{
  "name": "Chicken Tikka Masala",
  "description": "Tender chicken in a rich, creamy tomato sauce",
  "price": 16.99,
  "category": "Mains",
  "photoUrl": "https://..."
}

レスポンス (201 Created)

{
  "success": true,
  "data": {
    "id": "uuid",
    "name": "Chicken Tikka Masala",
    ...
  }
}

PATCH /api/menu-items/[id]

既存のメニューアイテムを更新します。変更したいフィールドのみを含めてください。

認証: 必須 (Bearer トークン)

リクエストボディ

{
  "price": 17.99,
  "description": "Updated description"
}

レスポンス (200 OK)

{
  "success": true,
  "data": {
    "id": "uuid",
    "price": 17.99,
    ...
  }
}

DELETE /api/menu-items/[id]

メニューアイテムと、それに関連付けられた写真および 3D モデルを完全に削除します。

認証: 必須 (Bearer トークン)

レスポンス (200 OK)

{
  "success": true,
  "data": { "deleted": true }
}