Wstepna dokumentacja:
- php server installed
- mysql server installed or internet hosted mysql server
- mod_rewrite enabled
- Put everything from repo to directory, where php server looks for .php files
- Change values inside file DBConnection.php to math mysql connection parameters
- Connect to mysql and copy/paste content of sqlScript.txt or execute this script as a query to prepare mysql server
- start php server
- done
All user endpoints
-
register - register user
body
``` { "email" : "[email protected]", "first_name":"user_name", "last_name": "user_last_name", "age": 25, "address": "krakow", "password":"yooo" } ```
-
login - login for registered user
body
``` { "email" : "[email protected]", "password":"yooo" } ```
- me - prints all information about current user
All products endpoints
-
products - inserts new product
body
``` { "name": "vn5", "category_id": 31, "alcohol_content": 99.5, "description": "zz", "country_origin_id": 25, "price": 100.99, "available_amount": 100, "rating": 4 } ```
- products - returns list of products, allows also to specify page and limit, or filters field, where available filters are:
- name - string, search by name
- price_min - float, minimal price
- price_max - float, maximum price
- alcohol_content_min - int, minimal content of an alcohol
- alcohol_content_max - int, maximal content of an alcohol
- category_id - int, by category
- products/{id} - return single product, where product id is {id}, {id} is integer
-
products/{id} - {id} is int, edits product with given id
body
``` { "name": "UpdatedProduct", "price": 9.99, "available_amount": 100, "rating": 4 } ```
- products/{id} - {id} is int, removes product with given id
All category endpoints
-
categories - inserts new category
body
``` { "name": "wóda", "description": "kopie mocno" } ```
- categories - returns list of categories
- categories/{id} - {id} is int, removes category with given id
All orders endpoints
- 0 - ORDER_STARTED
- 1 - AWAITING_PAYMENT
- 2 - PAYMENT_FAILED
- 3 - ORDER_FINISHED
-
orders - inserts new order
body
``` { "order_date": "2023-06-15 14:25:45", "user_id": 36, "state_id": 0 } ```
- orders - returns list of user orders
- orders/{id} - returns order with specified id
-
orders/{id} - {id} is int, edits order with given id
body
``` { "order_date": "2023-06-15 14:45:45" } ```
- orders/{id} - {id} is int, removes order with given id
All orders entries endpoints
-
orders_entries/{id} - {id} is int (order id), inserts new order entry for given order id
body
``` { "order_id": 12, "amount": 10, "product_id": 40, "historic_price": 33 } ```
- orders_entries/{id} - {id} as int (order id), returns all entries per order id
-
orders_entries/{id} - {id} is int, edits order entry with given id
body
``` { "product_id": 40, "historic_price": 33 } ```
- orders_entries/{id} - {id} is int, removes order entry with given id
All product opinion endpoints
-
product_opinions - inserts new product opinion
body
``` { "product_id": 40, "user_id": 36, "rate": 4, "description": "niestety, walory smakowe pozostawiają wiele do życzenia", "opinion_date":"2023-06-15 14:25:45" } ```
- product_opinions/{id} - {id} as int (product id), returns all opinions per product id
-
product_opinions/{id} - {id} is int, edits opinion with given id
body
``` { "description": "tani trunek na imprezy" } ```
- product_opinions/{id} - {id} is int, removes opinion with given id