REST API - Stores and Items Tracker
rest-apis-flask-python-project-w7md.onrender.com
(Initial load times may take longer to spin up due to server inactivity)
Backend web service created and deployed to allow clients to create stores and items using REST API endpoints. In addition, users can create a secure account encrypted through SHA-256 login methods. JSON Web Tokens (JWTs) are generated upon login and sensitive endpoints will be protected using implementations of JWT requirements.
Note: Click on the bolded endpoints below to view screen capture. Endpoints have been tested using Insomnia REST client.
POST /register
Create a new user with a username and password. The first user created will have a user ID of 1.
POST /login
Login to an existing account by authenticating account credentials. An access token and a refresh token will be generated automatically upon successful login attempt.
GET /user/id
Retrieve username from inputted account ID.
POST /store
Create a new store called McDonald's. The first store created will have the store ID of 1.
POST /item
Create a new item by inputting the name, Large Fries, the price, 3.49, and the associated store ID, 1. This item will have an item ID of 1.
POST /item
Create a new item by inputting the name, Big Mac, the price, 5.99, and the associated store ID, 1. This item will have an item ID of 2.
POST /item
Create a new item by inputting the name, Large Soda, the price, 0.99, and the associated store ID, 1. This item will have an item ID of 3.
POST /store
Create a new store called Burger King. This next store created will have the store ID of 2.
POST /item
Create a new item by inputting the name, Whopper, the price, 5.49, and the associated store ID, 2. This item will have an item ID of 4.
POST /item
Create a new item by inputting the name, Onion Rings, the price, 1.99, and the associated store ID, 2. This item will have an item ID of 5.
POST /item
Create a new item by inputting the name, Large Roast Coffee (Vanilla), the price, 2.99, and the associated store ID, 2. This item will have an item ID of 6.
POST /store
Create a new store called Chick-Fil-A. This next store created will have the store ID of 3.
POST /item
Create a new item by inputting the name, Spicy Chicken Sandwich, the price, 4.29, and the associated store ID, 3. This item will have an item ID of 7.
POST /item
Create a new item by inputting the name, 12 Pc. Chick-Fil-A Nuggets, the price, 5.70, and the associated store ID, 3. This item will have an item ID of 8.
POST /item
Create a new item by inputting the name, Large Fresh-Squeezed Lemonade, the price, 2.69, and the associated store ID, 3. This item will have an item ID of 9.
GET /item
Retrieve all item data stored in the database (1)
GET /item
Retrieve all item data stored in the database (2)
GET /item
Retrieve all item data stored in the database (3)
GET /store
Retrieve all store data stored in the database (1)
GET /store
Retrieve all store data stored in the database (2)
GET /item/id
Retrieve specific item data given the item's ID. Given ID 7, this endpoint will return the "Spicy Chicken Sandwich" item data.
DEL /item/id
Delete specific item given the item's ID. Given ID 7, this endpoint will delete the "Spicy Chicken Sandwich" item data.
GET /item/id
To check if the item has been deleted successfully, we run the GET item endpoint for item 7. The endpoint returns a 404 Not Found error, thus indicating the item has been deleted from the database.
GET /store/id
Retrieve specific store data given the store's ID. Given ID 3, this endpoint will return the "Chick-Fil-A" store data.
DEL /store/id
Delete specific store given the store's ID. Given ID 3, this endpoint will delete the "Chick-Fil-A" store data.
GET /store/id
To check if the store has been deleted successfully, we run the GET store endpoint for store 3. The endpoint returns a 404 Not Found error, thus indicating the store has been deleted from the database.
POST /register
Create a new user with a username and password. This new user will have a user ID of 2.
POST /login
Login to an existing account by authenticating account credentials. An access token and a refresh token will be generated automatically upon successful login attempt.
POST /logout
Revoke JWT from the user that has logged out. The JWT will be stored in a blocklist where it will be checked to determine if an endpoint can be accessed or not.
DEL /user/id
Delete specific user given the user's ID. Given ID 1, this endpoint will delete the "username" user data.
GET /user/id
To check if the user has been deleted successfully, we run the GET user endpoint for user 1. The endpoint returns a 404 Not Found error, thus indicating the user has been deleted from the database.