Closed DevUju closed 2 weeks ago
Develop an API endpoint to add new products with input validation
The endpoint should be accessible at api/products.
api/products
The endpoint should accept HTTP POST requests.
POST
The endpoint should be secured to ensure that only authenticated users can add new products.
Proper authentication mechanisms (e.g., JWT, OAuth2) should be implemented.
Requests to the endpoint must include a valid authentication token in the Authorization header. Authorization: Bearer <token>
Authorization: Bearer <token>
Request Body
{ product_name: "Product Name", price: 550.0, description: "Product Description" }
Response
On a successful addition of a new product, the API should return a 201 Created status code.
The response body should contain the newly created product details, including the product ID.
{ id: 1, product_name: "Product Name", price: 550.0, description: "Product Description" }
Validation
If any required field is missing or invalid, the API should return a 400 Bad Request status code with appropriate validation error messages.
{ statusCode: 400, message: ["name must be a string", "price must be a positive number"], error: "Bad Request" }
Provides a backend service which allows users to add new products to the system
POST /api/product
good ticket
@PrudentBird this issue is not for your team. None of you had a had creating this
Please remember to version the api
@Timmy-id why did you close this ticket?
wasn't your fault...sorry
Trini7y Obianuju muhammad235 akinwalexander
Description
Develop an API endpoint to add new products with input validation
Acceptance Criteria
The endpoint should be accessible at
api/products
.The endpoint should accept HTTP
POST
requests.The endpoint should be secured to ensure that only authenticated users can add new products.
Proper authentication mechanisms (e.g., JWT, OAuth2) should be implemented.
Requests to the endpoint must include a valid authentication token in the Authorization header.
Authorization: Bearer <token>
Request Body
Response
On a successful addition of a new product, the API should return a 201 Created status code.
The response body should contain the newly created product details, including the product ID.
Validation
If any required field is missing or invalid, the API should return a 400 Bad Request status code with appropriate validation error messages.
Purpose
Provides a backend service which allows users to add new products to the system
Requirements
Expected Outcome
Task
POST /api/product
to add new product.Testing