Skip to content

mhshahzad/order-pizza-api

Repository files navigation

logo

Order Pizza API

A RESTful API as pizza restaurant ordering system.

Built with (but not limited to) :

Setup

  1. git clone https://github.com/muhammadh-s/order-pizza-api
  2. cd order-pizza-api
  3. pip install -r requirements.txt or place virtual environment and then install
  4. python server.py

Usage

Example Response

curl -s https://order-pizza-api.herokuapp.com/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"}'  https://order-pizza-api.herokuapp.com/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
  }' 
  https://order-pizza-api.herokuapp.com/api/orders

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

  • DELETE : /orders/{Order_ID}
curl -X DELETE https://order-pizza-api.herokuapp.com/api/orders/1

License

MIT

Releases

No releases published

Packages

No packages published

Languages