Built with (but not limited to) :
git clone https://github.com/mhshahzad/order-pizza-api
cd order-pizza-api
pip install -r requirements.txt
or place virtual environment and then installpython3 server.py
(tested on python 3.8.0)
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
MIT