- go to the project's root directory (where the manage.py file is)
- pip install -r requirements.txt
- python manage.py makemigrations
- python manage.py migrate
- python manage.py runserver
Example requests to all endpoints (and all request methods) were performed in postman and file postman.json can be
Filtering list of products is done by adding ?attribute=value and ordering is done by adding ?ordering=attribute
Application uses BasicAuth so the Authorization header requires a value "Basic value" where the value is the encoded
To add a product, instead of using json format as in all other endpoints, i used form-data to pass in a picture directly.
- /statistics ['GET'] - get a list of top-selling products
- /products/ ['GET','POST'] - get a list of all products or add a new product
- /productCategories/ ['GET','POST'] - get a list of all categories or add a new category
- /orders/ ['GET','POST'] - get a list of all orders or add a new order
- /products/str:pk ['GET','PUT','DELETE'] - get, edit, or delete product with passed id
- /productCategories/str:pk ['GET','PUT','DELETE'] - get, edit, or delete category with passed id
- /orders/int:pk ['GET','PUT','DELETE'] - get, edit, or delete order with passed id
Users as well as sellers are predefined by the super user (created with python manage.py createsuperuser)
Anyone can perform GET request, only sellers can perform all PUT, DELETE and POST requests (except for ordering),
#Accounts i used to test (username, password):