Point of Sale API Admin Flow

The admin panel is used to create user accounts for the POS system, create and update dishes, and create and update dish ingredients.

To provide the proper experience for the admin panel, you’ll need to provide the following capabilities:

  1. Admin login
  2. Create ingredients
  3. Create dishes

Be sure you are familiar with the POS authentication flow details.

Step 1: Admin Login

The admin will log into the POS admin panel using their username and password.

Request

The client sends an HTTP request to exchange the user’s username and password for an access token.

Endpoint: POST /auth/token

curl -X 'POST' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/auth/token' \
  -H 'accept: application/json' \
  -H 'Authorization: Basic {base64EncodedclientidclientSecret}' \
  -H 'content-type: application/json' \
  -d '{
    "grant_type": "password",
    "user_name": "my-user-name",
    "password": "my-secure-password"
  }'

Response

If the request was successful, the server responds with a 201 Created status code with the response body containing access token.

Step 2: Create Ingredients

Ingredients are components of dishes. Admins create ingredients and specify their quantity so they can track inventory and ensure patrons cannot order dishes that can’t be made due to insufficient ingredient stock.

Request

The client sends an HTTP request to create a new ingredient and specify the in stock quantity.

Endpoint: POST /ingredients

curl -X 'POST' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/ingredients' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer {bearerToken}' \
  -H 'content-type: application/json' \
  -d '{
    "display_name": "basil",
    "name": "basil",
    "in_stock_qty": 100
  }'

Response

If the request was successful, the server responds with a 201 Created status code with the response body containing the full resource.

The ingredient object contains the following properties:

PropertyTypeDescription
ingredient_idstringThe ingredient id - used to associate an ingredient with a dish
created_atstringThe date and time the ingredient was created. Uses ISO 8601 standard. Ex: 2025-04-05T14:55:03.824Z
updated_atstringThe date and time the ingredient was most recently updated. Uses ISO 8601 standard. Ex: 2025-04-05T14:55:03.824Z
display_namestringThe ingredient name that will appear in the POS system for patrons and staff
namestringThe ingredient name used primarily in the admin panel
in_stock_qtyintegerThe quantity of the ingredient currently available - used to track that an ingredient has a positive quantity

Step 3: Create Dishes

Admins create dishes by associated them with the necessary ingredients.

The request body for creating dishes should contain the following properties:

PropertyTypeDescription
display_namestringRequired The dish name that appears in the POS system for patrons and staff
namestringRequired The dish name used primarily in the admin panel
descriptionstringRequired The long-text description of the dish.
categoryenum stringRequired The category the dish belongs to. Values: Appetizers, Main Course, Dessert, and Drinks.
preparation_timeintegerOptional The time it takes to prepare the dish, in minutes.
pricenumberRequired The price of the dish.
image_namestringOptional The name of the image associated with the dish, if available.
stationenum stringRequired The name of the station the dish is prepared at. Values: hot, cold, beverage
ingredientsarray of objectsRequired Object that contains the ingredient details of the ingredients included in the dish.
ingredients.ingredient_idstringRequired The id of the ingredient
ingredients.is_essentialbooleanRequired Indicates whether this ingredient is required to make this dish or not.

Request

The client sends an HTTP request to {describe the purpose of the API request}.

Endpoint: POST /dishes

curl -X 'POST' \
  'https://reimagined-journey-g45xxv4v6gwhvrrr-80.app.github.dev/dishes' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer {bearerToken}' \
  -H 'content-type: application/json' \
  -d '{
    "display_name": "Caprese Salad",
    "name": "Caprese Salad",
    "description": "Deconstructed tomato, basil, and fresh mozzeralla with a sprinkle of balsamic vinegar.",
    "category": "Appetizers",
    "price": 899,
    "station": "cold",
    "ingredients": [
      {
        "ingredient_id": "tomatoIngredientId",
        "is_essential": true
      },
      {
        "ingredient_id": "basilIngredientId",
        "is_essential": true
      },
      {
        "ingredient_id": "mozzIngredientId",
        "is_essential": true
      },
      {
        "ingredient_id": "balsVinegarIngredientId",
        "is_essential": true
      },
    ]
  }'

Response

If the request was successful, the server responds with a 201 Created status code with the response body containing new resource and the dish_id, which you’ll use in numerous requests in both the patron and staff flows.