CRUD Operations on Categories
-
Add Category (POST)
URL:http://localhost:8080/api/categories
Body:{ "categoryId": 0, "categoryName": "String", "categoryDescription": "String", "products": [] }
-
Update Category (PUT)
URL:http://localhost:8080/api/categories/{id}
Body:{ "id": 0, "categoryId": 0, "categoryName": "String", "categoryDescription": "String", "products": [] }
-
Get All Categories (GET)
URL:http://localhost:8080/api/categories?page=0
-
Get All Categories (GET)
a. URL:http://localhost:8080/api/categories
Description: Using this you will get first 5 categories
b. URL:http://localhost:8080/api/categories?page=0
Description: Using this you will get 5 categories of page 0 and you can change page likehttp://localhost:8080/api/categories?page=1
c. URL:http://localhost:8080/api/categories?page=0&size=5
Description: Using this you will get 5 categories of page 0 with default page size 5 and you can change page and size likehttp://localhost:8080/api/categories?page=1&size=10
and you will get page 1 and 10 categories will be displayed -
Get Category by Id (GET)
URL:http://localhost:8080/api/categories/{id}
Body:{ "id": 0 }
-
Delete Category by Id (DELETE)
a. URL:http://localhost:8080/api/categories/{id}
Body:{ "id": 0 }
Description: Deletes the category with the specified ID if the product table does not contain entries associated with this category. If products exist, the category will not be deleted.
b. URL:http://localhost:8080/api/categories/{id}?force=true
Body:{ "id": 0 }
Description: Deletes the category with the specified ID along with associated products, regardless of whether products exist or not.
CRUD Operations on Products
-
Add Default Products (GET)
URL:http://localhost:8080/api/products/addDefault
-
Add New Product (POST)
URL:http://localhost:8080/api/products
Body:{ "id": 0, "name": "String", "cost": 0.0, "category": { "categoryId": 0, "categoryName": "String", "categoryDescription": "String", "products": [] } }
-
Get Product by Id (GET)
URL:http://localhost:8080/api/products/{id}
Body:{ "id": 0 }
-
Get All Products (GET)
URL:http://localhost:8080/api/products?page=0
-
Get All Products (GET)
a. URL:http://localhost:8080/api/products
Description: Using this you will get first 5 products
b. URL:http://localhost:8080/api/products?page=0
Description: Using this you will get 5 products of page 0 and you can change page likehttp://localhost:8080/api/products?page=1
c. URL:http://localhost:8080/api/categories?page=0&size=5
Description: Using this you will get 5 products of page 0 with default page size 5 and you can change page and size likehttp://localhost:8080/api/products?page=1&size=10
and you will get page 1 and 10 products will be displayed -
Delete Product by Id (DELETE)
URL:http://localhost:8080/api/products/{id}
Body:{ "id": 0 }
-
Update Product by Id (PUT)
URL:http://localhost:8080/api/products/{id}
Body:{ "id": 0, "name": "String", "cost": 0.0, "category": { "categoryId": 0, "categoryName": "String", "categoryDescription": "String", "products": [] } }