API Documentation: User Controllers
Base URL: /api/user/address
- Description: Retrieve all saved addresses for the user.
- Response:
200 OKwith list ofAddressDTO, or500 Internal Server Error
-
Description: Add a new address.
-
Request Body:
AddressDTO(validated) -
Response:
201 Createdon success500 Internal Server Erroron failure
-
Description: Edit an existing address.
-
Request Body:
AddressDTO(must includeid) -
Validations:
- Address
idmust not be null - Address must belong to current user
- Address
-
Response:
200 OKon success400 Bad Requestif invalid or unauthorized500 Internal Server Erroron failure
-
Description: Delete an address by UUID
-
Path Param:
id- UUID of address -
Response:
200 OKon success400 Bad Requestif not user's address500 Internal Server Error
Base URL: /api/user/cart
- Description: Fetch all cart items for the user.
- Response:
200 OKwith keycartItems: List<CartProductDTO>
-
Description: Add a product to cart.
-
Path Param:
id- UUID of Product -
Response:
201 Createdif added202 Acceptedif already present400 Bad Requestif invalid500 Internal Server Error
-
Description: Delete a product from the cart
-
Path Param:
id- UUID of cart item -
Validations:
- Must belong to current user
-
Response:
200 OKon success400 Bad Requestif unauthorized500 Internal Server Error
-
Description: Edit a product in the cart
-
Request Body:
CartProductRequestBody(includesidandquantity) -
Response:
200 OKon success400 Bad Requestif not owned500 Internal Server Error
Base URL: /api/user/info
- Description: Fetch current user's profile info (DTO)
- Response:
200 OKwith user DTO
Base URL: /api/user/payment
-
Description: Create a new Razorpay order
-
Request Param:
amount(int) -
Response:
201 Createdwith Razorpay order object500 Internal Server Erroron failure
-
Description: Verify Razorpay payment
-
Request Body:
TransactionDTO(with order/payment/signature) -
Request Param:
orderId -
Validation:
- Uses Razorpay SDK to verify signature
-
Response:
200 OKif success400 Bad Requestif invalid500 Internal Server Errorif any failure
Base URL: /api/user/profile
-
Description: Create a user profile
-
Request Body:
ProfileDTO -
Response:
201 Createdwith profile data400 Bad Requestif already exists500 Internal Server Error
- Description: Retrieve current user profile
- Response:
200 OKwithProfileDTO
-
Description: Edit user profile
-
Request Body:
ProfileDTO(with ID) -
Validations:
- Profile must belong to user
-
Response:
200 OKwith updated profile400 Bad Requestif unauthorized or ID missing500 Internal Server Error
-
Description: Delete profile
-
Request Param:
id- UUID -
Validations:
- Profile must belong to user
-
Response:
200 OKon success400 Bad Requestif unauthorized500 Internal Server Error
Base URL: /api/user/order
- Description: Get all user orders
- Response:
200 OKwith list ofOrderDTO
-
Description: Get details of a specific order
-
Request Param:
id(String) -
Response:
200 OKwithOrderDTO2400 Bad Requestif not found500 Internal Server Error
Base URL: /api/user/verifyEmail
-
Description: Trigger email verification
-
Request Body:
VerifyEmailBody(includes email) -
Response:
200 OKon success500 Internal Server Erroron failure
-
Description: Verify email link via code
-
Path Param:
url(verification token code) -
Validation:
- Token expiration
- Ownership
-
Response:
200 OKon successful verification400 Bad Requestif expired or malformed401 Unauthorizedif token doesn't match user500 Internal Server Erroron failure
Base URL: /api/admin/orders
- Description: Retrieve all orders.
- Response:
202 Acceptedwith a list ofOrder500 Internal Server Erroron failure
- Description: Retrieve a specific order by ID.
- Path Param:
id(String) - Response:
202 Acceptedwith theOrderobject400 Bad Requestif the ID is invalid
Base URL: /api/admin/product
- Description: Create a new product.
- Request Body:
Product - Response:
200 OKwith the createdProduct500 Internal Server Erroron failure
- Description: Get all products.
- Response:
200 OKwith a list ofProductDTO
- Description: Get product by ID.
- Path Param:
id(UUID) - Response:
200 OKwith theProduct404 Not Foundif product doesn't exist
- Description: Delete a product by ID.
- Path Param:
id(UUID) - Response:
200 OKon success404 Not Foundon failure
- Description: Update an existing product.
- Request Body:
Product(must includeid) - Response:
200 OKwith the updatedProduct500 Internal Server Erroron failure
Base URL: /api/public
- Description: Create a new user account.
- Request Body:
AuthBody(contains username and password) - Response:
201 Createdon success409 Conflictif username already exists500 Internal Server Erroron failure
- Description: Authenticate a user and return JWT access token and refresh token cookie.
- Request Body:
AuthBody - Response:
200 OKwith JWT access token and email401 Unauthorizedif credentials are incorrect500 Internal Server Erroron failure
Base URL: /api/public/products
- Description: Get all public products.
- Response:
200 OKwith list ofProductDTO
Base URL: /api/public/refresh
- Description: Get a new access token using a refresh token from cookie.
- Cookie Required:
refreshToken - Response:
200 OKwith new access token401 Unauthorizedif token is expired or invalid
Base URL: /api/public/resetPassword
- Description: Send a one-time password (OTP) to the email linked with the username.
- Query Param:
username - Response:
200 OKif OTP sent successfully400 Bad Requestif username or email not found
- Description: Verify the OTP for password reset.
- Query Params:
code(Long) – OTP codeid(UUID) – OTP identifier
- Response:
200 OKwith JWT token for reset400 Bad Requestif OTP is incorrect or max retries exceeded500 Internal Server Erroron failure
- Description: Reset the user’s password after OTP verification.
- Headers:
reset-password-jwtToken - Query Param:
password - Response:
200 OKif password is updated successfully401 Unauthorizedif reset token is tampered500 Internal Server Erroron failure