Skip to content

Latest commit

 

History

History
106 lines (85 loc) · 2.28 KB

README.md

File metadata and controls

106 lines (85 loc) · 2.28 KB

logo

Order Pizza API

A RESTful API for a pizza restaurant ordering system

Run in Postman

Built with (but not limited to) :

Setup

  1. git clone https://github.com/mhshahzad/order-pizza-api
  2. cd order-pizza-api
  3. pip install -r requirements.txt or place virtual environment and then install
  4. python3 server.py (tested on python 3.8.0)

Usage

Example Response

curl -s http://localhost:8000/api/orders
[
  {
    "Crust": "NORMAL",
    "Flavor": "BEEF-NORMAL",
    "Order_ID": 1,
    "Size": "M",
    "Table_No": 1,
    "Timestamp": "2018-12-12T13:42:13.704148+00:00"
  },
  {
    "Crust": "THIN",
    "Flavor": "CHEESE",
    "Order_ID": 2,
    "Size": "S",
    "Table_No": 5,
    "Timestamp": "2018-12-12T13:42:13.704148+00:00"
  },
  {
    "Crust": "NORMAL",
    "Flavor": "CHICKEN-FAJITA",
    "Order_ID": 3,
    "Size": "L",
    "Table_No": 3,
    "Timestamp": "2018-12-12T13:42:13.720690+00:00"
  }
]

Endpoints

  • POST : /auth
  curl -X POST -H "Content-Type: application/json" -d '{"username": "test", "password": "test"}'  http://localhost:8000/api/auth
  • POST : /orders (Access Token is required)
curl 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer <JWT>" 
  -X POST 
  -d  
 '{
    "Flavor": "ABC", 
    "Crust": "XYZ",
    "Size": "XL", 
    "Table_No": 9
  }' 
  http://localhost:8000/api/orders

Do replace the <JWT> in the above request with the token you have acquired.

  • DELETE : /orders/{Order_ID}
curl -X DELETE http://localhost:8000/api/orders/1

License

MIT