SoftwareSandbox / Fiazard

Learning project in which we try to make our sandwich ordering site better. This is the backend project, providing RESTful webservices with DropWizard.
Apache License 2.0
2 stars 10 forks source link

Products Resource #3

Open Sch3lp opened 9 years ago

Sch3lp commented 9 years ago

Products

Resource

/v1/products/

Returns

[
  {
    "id": "1",
    "categoryId": "1",
    "name": "Club cheese",
    "composition": [
      "gouda cheese",
      "salad",
      "tomatoes",
      "egg"
    ],
    "sauces": [
      "mayonaise"
    ],
    "type": "Club",
    "price": 2.0
  },
  {
    "id": "2",
    "categoryId": "1",
    "name": "Breeze",
    "composition": [
      "brie",
      "walnuts"
    ],
    "sauces": [
      "honey"
    ],
    "type": "Special",
    "price": 3.5
  },
  {
    "id": "3",
    "categoryId": "2",
    "name": "Club Ham",
    "composition": [
      "ham",
      "salad",
      "tomatoes",
      "egg"
    ],
    "sauces": [
      "mayonaise"
    ],
    "type": "Club",
    "price": 2.0
  },
  {
    "id": "4",
    "categoryId": "2",
    "name": "Club Parma",
    "composition": [
      "parmaham",
      "salad",
      "tomatoes",
      "egg"
    ],
    "sauces": [
      "mayonaise"
    ],
    "type": "Club",
    "price": 3
  }
]

Parameters

CategoryId

http://localhost:8080/v1/products?categoryId=1

Returns only products of given categoryId.

Child paths

/{:id}

Returns product with given id.

Persistence

I figure in a mongo Collection called Products?