A dummy web API for a facilitating pizza delivery
https://pizzapi.herokuapp.com/
Flask
Flask-RESTful
Flask-JWT
Flask-SQLAlchemy
Basic Pizza API
- Python 3.6.3
- Flask, Flask-RESTful, Flask SQLAlchemy
- SQLite
- Heroku to host the site
- POSTMAN to test the API
This project is implemented using Python3, Flask, POSTMAN, SQLAlchemy. Perform following steps to get and post requests.
- Install Postman
https://www.getpostman.com/
- Open the link where API is hosted
https://pizzapi.herokuapp.com/
- Open Postman and manage environment variables. Following is an example:
- Declare endpoints to perform operation like below:
end points
- Set environment variable in endpoints.
{{url}} in GET/POST/DELETE/ endpoints
{{jwt_token}} in Headers:
a) Select Authorization
b) JWT {{jwt_token}}
- For GET and Post an item:
Use Get endpoint:
-- type {{url}}/item/<id>
Use Post\put endpoint
-- type {{url}}/item/<name of string>
-- in Body field add like below:
{
"timeOpen" : 10,
"timeClose" : 20
}
- Authorization for POST and DELETE
- To delete an item by name. User need to register first.
- Then create POST /auth endpoint. POST following sample code to authenticate a registered user:
{
"username" : "username_with_which_you_registered",
"password" : "password_with_which_you_registered"
}
- After doing auth successfully. JWT token will be generated. Use that for deleting an item:
--Select Authorization as Key in header, and Add JWT {{JWT}} in value.
End of document.