Mowgli's Cafe API Documentation

Summer 2019

Overview

This web service provides the menu and ordering services for Mowgli's Café.

Menu API

Endpoint: https://courses.cs.washington.edu/courses/cse154/webservices/mowgliscafe/mowgliscafe.php

The mowgliscafe.php web service provides the menu for Mowgli's café and accepts one "GET" query parameter menu which is used one of two ways, as well as a "POST" request with order information.

Query 1: Get the entire menu

Request Format: mowgliscafe.php?menu=all
Request Type: GET
Returned Data Format: JSON

Description: Returns returns a detailed JSON object containing data for the entire menu for the cafe.

Request: https://courses.cs.washington.edu/courses/cse154/webservices/mowgliscafe/mowgliscafe.php?menu=all

Output: (abbreviated)



{
  "Drinks" : [
    {
      "category" : "Coffee",
      "items" : [
        {
          "name" : "Brewed Coffee (Black)",
          "price" : "1.25",
          "cost" : "0.65"
        },
        {
          "name" : "Brewed Coffee (With Cream)",
          "price" : "1.50",
          "cost" : "0.85"
        },
       ...
      ]
    },
    ...
  ],
  "Bakery" : [
    {
      "category" : "Scones",
      "items" : [
        {
          "name" : "Blueberry Scone",
          "price" : "3.50",
          "cost" : "0.75"
        },
        ...
       ]
    },
    ...
  ]
}

        

The values of the returned JSON object include a list of subcategories of that category. Each subcategory of the category (like "Coffee" in "Drinks") has a list of "items". Each item has a "name", "price" and "cost" associated with it.

Query 2: Get Specific Menu Categories

Request Format: mowgliscafe.php?menu={category}
Request Type: GET
Returned Data Format: JSON

Description: The second request type takes as a parameter any café category and returns a detailed JSON object containing data for that part of the menu for the cafe.

Request: https://courses.cs.washington.edu/courses/cse154/webservices/mowgliscafe/mowgliscafe.php/menu=Drinks

Example Output:



{
  "Drinks" : [
    {
      "category" : "Coffee",
      "items" : [
        {
          "name" : "Brewed Coffee (Black)",
          "price" : "1.25",
          "cost" : "0.65"
        },
        {
          "name" : "Brewed Coffee (With Cream)",
          "price" : "1.50",
          "cost" : "0.85"
        },
       ...
      ]
    },
    ...
  ]
}        

The values listed in this JSON object are the same as what is returned by the mowgliscafe.php?menu=all query.

Query 3: Submit an order

Request Format: mowgliscafe.php with form data
Request Type: POST
Returned Data Format: Text

Description: Accepts the provided order information, returning a response of success.

POST parameters:

Output:



Your order has been processed!