1
0
forked from s434786/DINO_SCRUM
DINO_SCRUM/README.md

2.6 KiB

DINO_SCRUM

DINO_SCRUM

API Endpoints

POST /api/product/change-quantity

{
 "id": Int,
 "change": Int
}

Return:

{
 "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:

{
    "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:

{
 "price-of-all": Float
}

Return price of all products.


POST /api/product/add

{
 "id": Int,
 "name": String,
 "price": Float,
 "quantity": Int,
 "quantityMax": Int,
 "imageLink": String
}

Return:

{
 "id": Int,
 "name": String,
 "price": Float,
 "quantity": Int,
 "quantityMax": Int,
 "imageLink": String
}

Create and return a new product.


DELETE /api/delete-product

{
 "id": Int
}

Delete product with id.


GET /api/product/get-by-id

{
 "id": Int
}

Return:

{
 "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.

{
 "id": Int,
 "name": String,
 "price": Float,
 "quantity": Int,
 "quantityMax": Int,
 "imageLink": String
}

Return:

{
 "id": Int,
 "name": String,
 "price": Float,
 "quantity": Int,
 "quantityMax": Int,
 "imageLink": String
}

Return updated product.