This project was built as part of a test, it is a simple API made for storing products and its attributes, it expects to have two different types of users, admins & anonymous.
- Clone this Project
- cd to
zb_test
- run docker-compose up --build
- Run unit tests:
- cd to
zb_test
- run: docker-compose exec zb_web python manage.py test .
- cd to
- Using postman:
- cd to
zb_test/utils/postman
- import those files to your postman
- cd to
Url: /login/
payload:
{
"username": string,
"password": string
}
response (200):
{
"id": integer,
"username": string,
"access": string,
"refresh": string
}
Url: /products/
payload:
{
"name": string,
"price": float,
"brand": string
}
parameters:
-
name: product's name
-
price: product's price
-
brand: product's brand name
response (201):
{
"sku": string,
"price": float,
"name": string,
"brand": {
"name": string
}
}
Url: /products/{SKU}/details
parameters:
SKU: alphanumeric product's SKU
response (200)
{
"sku": string,
"price": float,
"name": string,
"brand": {
"name": string
},
"watch_record": integer
}
watch_record: how many times an anonymous user retrieve that product
Url: /products/{SKU}
payload:
{
"name": string,
"price": float,
"brand": string
}
parameters:
-
SKU: alphanumeric product's SKU
-
name: product's name (OPTIONAL)
-
price: product's price (OPTIONAL)
-
brand: product's brand name (OPTIONAL)
response (204)
Url: /products/{SKU}
parameters:
- SKU: alphanumeric product's SKU
Url: /admins/
payload:
{
"username": string,
"password": float,
"email": string
}
response (200):
{
"id": integer,
"username": string
}
Url: /admins/{ID}/
payload:
{
"username": string (optional),
"password": float (optional),
"email": string (optional)
}
parameters:
- ID: Admin's ID
response (204)
Url: /admins/{ID}/
parameters:
- ID: Admin's ID
response (204)
made with ❤️ by Alejandro Olaria.