You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Develop an endpoint that allows for the creation of a new billing plan within the system.
Endpoint
POST/api/v1/billing-plans
Request
Headers
Authorization: Bearer <token>
Content-Type: application/json
Body
{
"name": "string",
"price": "number"
}
Response
Success (201 Created)
Body
{
"Status": 201,
"Message": "Billing plan created successfully",
"Data": {
"id": "string",
"name": "string",
"price": "number"
}
}
Failure (401 Unauthorized)
Body
{
"Status": 401,
"Message": "Unauthorized"
}
Failure (500 Internal Server Error)
Body
{
"Status": 500,
"Message": "Internal server error"
}
Acceptance Criteria
The endpoint must require authorization and return a 401 error if the user is not authenticated.
Upon successful creation, the endpoint must return a 201 status with a message indicating success, a status code of 201, and the details of the created billing plan under the Data key.
The endpoint should handle unexpected errors and return a 500 status with an appropriate error message.
Additional Details
Authorization: Ensure that only authenticated users can access this endpoint. Unauthorized users should receive a clear 401 error response.
Data Validation: Implement validation for the request body to ensure name is a non-empty string and price is a valid number.
Error Handling: Ensure proper error handling to return meaningful error messages and appropriate HTTP status codes.
Logging: Include logging for both successful operations and errors to facilitate debugging and monitoring.
The text was updated successfully, but these errors were encountered:
Description
Develop an endpoint that allows for the creation of a new billing plan within the system.
Endpoint
POST
/api/v1/billing-plans
Request
Headers
Authorization: Bearer <token>
Content-Type: application/json
Body
Response
Success (201 Created)
Body
Failure (401 Unauthorized)
Body
Failure (500 Internal Server Error)
Body
Acceptance Criteria
Data
key.Additional Details
name
is a non-empty string andprice
is a valid number.The text was updated successfully, but these errors were encountered: