Point of Sale Patron API Flow

To provide the proper experience to patrons using the Point of Sale (POS) API, you’ll need to build the following capabilities:

  1. Allow the patron to browse available dishes by category (appetizers, main course, drinks, and desserts).
  2. Ensure the essential ingredients for the dish are in stock.
  3. Allow the patron to view dish details prior to ordering.
  4. Let the patron add a dish to their cart and view it.
  5. Create the order in the system.
  6. Confirm to the patron the order has been successfully placed.

Step 1: Browse dishes by category

Patrons will start by browsing in the ordering app and should be able to view dishes specific to the category they select.

Available values for categories:

  • Appetizers
  • Main Course
  • Dessert
  • Drinks

Request

The client sends an HTTP request to retrieve a list of dishes filtered by the selected category.

Endpoint: GET /dishes

curl -X 'GET' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/dishes?filter=category.eq~{categoryName}' \
  -H 'accept: application/json'

Response

If the request was successful, the server responds with a 200 okay status code and a response body containing the list of dishes in that category.

Each dish object includes the following properties:

PropertyTypeDescription
idstringThe dish id (required for calls later in this flow)
created_atstringThe date and time the dish was created. Uses ISO 8601 standard. Ex: 2025-04-05T14:55:03.824Z
updated_atstringThe date and time the dish was most recently updated. Uses ISO 8601 standard. Ex: 2025-04-05T14:55:03.824Z
namestringThe name of the dish.
descriptionstringThe long-text description of the dish.
categoryenum stringThe category the dish belongs to. Values: Appetizers, Main Course, Dessert, and Drinks.
preparation_timeintegerThe time it takes to prepare the dish, in minutes.
pricenumberThe price of the dish.
image_namestringThe name of the image associated with the dish, if available.
stationenum stringThe name of the station the dish is prepared at. Values: hot, cold, beverage
ingredientsarray of objectsObject that contains the ingredient details of the ingredients included in the dish.
ingredients.ingredient_idstringThe id of the ingredient (required for calls later in this flow)
ingredients.is_essentialbooleanIndicates whether this ingredient is required to make this dish or not.
ingredients._idstringSome other id for the ingredient

Step 2: Check ingredient quantities

Next, the client app must confirm the in stock quantities of the essential ingredients for the dishes.

Request

The client sends HTTP requests to retrieve the name and in_stock_qty properties for each ingredient. You’ll need the ingredient_id for each ingredient to check and you’ll filter the response to include only the in_stock_qty and name fields.

Endpoint: GET /ingredients/{id}

curl -X 'GET' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/ingredients/{ingredient_id}?fields=in_stock_qty|name' \
  -H 'accept: application/json'

Response

If the request was successful, the server responds with a 200 okay status code and a response body that includes the requested resource.

Any dishes that have essential ingredients with an in_stock_qty of 0 should display as unavailable in the client app so they cannot be added to an order.

Step 3: View dish details

The patron will select a dish to see its details.

Request

The client sends HTTP requests to retrieve the name, price, description, and ingredients properties for the selected dish. For this call, you’ll need the id for the selected dish.

Endpoint: GET /dishes/{id}

curl -X 'GET' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/dishes/{id}?fields=name|price|description|ingredients' \
  -H 'accept: application/json'

Response

If the request was successful, the server responds with a 200 okay status code and a response body that includes the following properties:

PropertyTypeDescription
idstringThe dish id
namestringThe name of the dish.
descriptionstringThe long-text description of the dish.
pricenumberThe price of the dish.
image_namestringThe name of the image associated with the dish, if available
ingredientsarray of objectsObject that contains the ingredient details of the ingredients included in the dish
ingredients.ingredient_idstringThe id of the ingredient (required for calls later in this flow)
ingredients.is_essentialbooleanIndicates whether this ingredient is required to make this dish or not.
ingredients._idstringSome other id for the ingredient

Step 4: Add a dish and view the cart

The patron can now add the dish to their cart and then view the cart when they are ready to place their order. The client app keeps track of the dishes added to the cart.

Step 5: Place the order

When the patron has finished adding dishes to their cart, they can then place their order.

This request requires authorization with a bearer token, as well as the following properties in the request body:

PropertyTypeDescription
namestringThe name of the patron
table_numberintegerThe patron’s table number
dish_idsarray of stringsThe ids of all the dishes included in the order
special_requestsstringThe text the patron included in the special request field of their order
scheduled_atstringnullable The date and time the order is scheduled to arrive, using ISO 8601 format

Request

The client sends an HTTP request with an authorization header and request body that includes the dish ids from local storage and the other required properties for the order.

Endpoint: POST /orders

curl -X 'POST' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/orders' \
  -H 'accept: application/json' \
  -H 'content-type: application/json' \
  -H 'Authorization: Bearer {bearerToken}' \
  -d '{
    "name": "Sarah",
    "table_number": 13,
    "dish_ids": [
      "{id}"
    ],
    "special_requests": "None",
    "scheduled at": null
  }'

Response

If the request was successful, the server responds with a 201 created status code and a response body that includes the resource.

Step 6: Confirm the order

The patron should receive a success message that says, “We’ve received your order!” upon the successful creation of the order.