# DINO\_SCRUM DINO\_SCRUM ## API Endpoints *POST* **/api/product/change-quantity** ```json { "id": Int, "change": Int } ``` Return: ```json { "id": Int, "name": String, "price": Float, "quantity": Int, "quantityMax": Int, "imageLink": String } ``` Edit quantity and return the product. * * * *GET* **/api/get-all** Return all products sorted by id. *GET* **/api/get-all?page=X&size=Y** Return page *X* with size *Y* of all products sorted by id. *GET* **/api/get-all?page=X&size=Y&sorted=Z** Return page *X* with size *Y* of all products sorted by *Z* field. *GET* **/api/get-all?sorted=Z** Return all products sorted by *Z*. Return: ```json { "content": [ { "id": Int, "name": String, "price": Float, "quantity": Int, "quantityMax": Int, "imageLink": String } { (...) } ], "pageable": { "sort": { "sorted": Boolean, "unsorted": Boolean, "empty": Boolean }, "offset": Int, "pageSize": Int, "pageNumber": Int, "unpaged": Boolean, "paged": Boolean }, "totalPages": Int, "totalElements": Int, "last": Boolean, "size": Int, "number": Int, "numberOfElements": Int, "first": Boolean, "sort": { "sorted": Boolean, "unsorted": Boolean, "empty": Boolean }, "empty": Boolean } ``` * * * *GET* **/api/get-price-of-all** Return: ```json { "price-of-all": Float } ``` Return price of all products. * * * *POST* **/api/product/add** ```json { "id": Int, "name": String, "price": Float, "quantity": Int, "quantityMax": Int, "imageLink": String } ``` Return: ```json { "id": Int, "name": String, "price": Float, "quantity": Int, "quantityMax": Int, "imageLink": String } ``` Create and return a new product. * * * *DELETE* **/api/delete-product** ```json { "id": Int } ``` Delete product with id. * * * *GET* **/api/product/get-by-id** ```json { "id": Int } ``` Return: ```json { "id": Int, "name": String, "price": Float, "quantity": Int, "quantityMax": Int, "imageLink": String } ``` Return product with id. * * * *POST* /api/product/update/{id} Id is require, other field could be null. ```json { "id": Int, "name": String, "price": Float, "quantity": Int, "quantityMax": Int, "imageLink": String } ``` Return: ```json { "id": Int, "name": String, "price": Float, "quantity": Int, "quantityMax": Int, "imageLink": String } ``` Return updated product.