Get Products
Headers
Bearer token for authentication
Query Parameters
Search term to filter products by name or description
Filter by product category
Filter by product brand
Filter by supplier
Filter by availability status (e.g., “available”, “limited”, “unlimited”)
Minimum price filter
Maximum price filter
Page number for pagination
Number of items per page
Field to sort by (e.g., “name”, “price”, “stock”)
Sort order: “asc” or “desc”
Response
Indicates if the request was successful
Array of product objects
Pagination information including total, pages, current page
Example Request
Example Response
Error Codes
401- Unauthorized - Invalid or missing token500- Internal server error
Create Product
Headers
Bearer token for authentication
Request Body (FormData)
Product name
Product description
Product price
Initial stock quantity
Product category
Product brand
Supplier name
Availability status
Product image file (multipart/form-data)
Response
Indicates if the product was created
Created product object
Success or error message
Example Request
Example Response
Error Codes
400- Invalid input or missing required fields401- Unauthorized403- Forbidden - Admin role required500- Internal server error
Update Product
Headers
Bearer token for authentication
Path Parameters
ID of the product to update
Request Body (FormData)
Product name
Product description
Product price
Stock quantity
Product category
Product brand
Supplier name
Availability status
New product image file
Response
Indicates if the update was successful
Updated product object
Success or error message
Example Request
Example Response
Error Codes
400- Invalid input401- Unauthorized403- Forbidden - Admin role required404- Product not found500- Internal server error
Delete Product
Headers
Bearer token for authentication
Path Parameters
ID of the product to delete
Response
Indicates if deletion was successful
Confirmation message
Example Request
Example Response
Error Codes
401- Unauthorized403- Forbidden - Admin role required404- Product not found500- Internal server error
Update Stock
Headers
Bearer token for authentication
Path Parameters
ID of the product
Request Body
Quantity to add or subtract
Operation type: “add” or “subtract”
Response
Indicates if stock was updated
Updated product with new stock
Example Request
Example Response
Get Stock History
Headers
Bearer token for authentication
Path Parameters
ID of the product
Response
Indicates if request was successful
Array of stock change records
Example Request
Example Response
Error Codes
401- Unauthorized404- Product not found500- Internal server error