Create an API endpoint that allows an authenticated user retrieve all product categories thus providing essential information for product navigation and filtering.
This endpoint will validate the user and then return all product categories stored in the database.
Acceptance Criteria
The endpoint allows an authenticated user retrieve a list of all product categories.
Returns a 200 status code and the correct response body when the data is successfully retrieved.
Returns a 401 status code when the user is not authenticated
Returns a 500 status code when a server error occurs
Requirements
Implement API endpoint for retrieving product categories.
Ensure response is properly structured.
Handle unexpected errors and return the appropriate status code.
Expected Outcome
Users should be able to send a request to the backend to retrieve all the product categories.
Description
Create an API endpoint that allows an authenticated user retrieve all product categories thus providing essential information for product navigation and filtering.
This endpoint will validate the user and then return all product categories stored in the database.
Acceptance Criteria
200
status code and the correct response body when the data is successfully retrieved.401
status code when the user is not authenticated500
status code when a server error occursRequirements
Expected Outcome
Endpoints
[GET] /api/v1/products/categories
Responses
Success Response:
200 OK
Unauthorized Response:
401 Unauthenticated
Server Error Response:
500 Server Error
Test Scenarios
Successful Retrieval of Product Categories
200
.Unauthenticated Request
401 Unauthenticated
status code.