Open JoshuaOloton opened 3 weeks ago
Develop API endpoints to retrieve and update the details of API status. The following endpoints should be created:
/api/v1/api-status
Table api_status { id int [pk, increment] // Primary key api_group varchar [not null] status varchar [not null] // Operational, Degraded, Down response_time decimal // Response time in milliseconds details text last_checked timestamp [default: `CURRENT_TIMESTAMP`] created_at timestamp [default: `CURRENT_TIMESTAMP`] updated_at timestamp }
{ "status_code": 200, "success": true, "message": "All API Status fetched successfully", "data": [ { "last_checked": "2024-08-23T23:21:32.555541+01:00", "id": "066c90b6-c907-7357-8000-3ae387f7153d", "created_at": "2024-08-23T23:21:32.555541+01:00", "status": "Down", "response_time": null, "api_group": "Login User", "details": "Bad Gateway", "updated_at": "2024-08-23T23:21:32.555541+01:00" }, { "last_checked": "2024-08-23T23:21:32.572124+01:00", "id": "066c90b6-c927-7fb5-8000-36f31796d5c0", "created_at": "2024-08-23T23:21:32.572124+01:00", "status": "Down", "response_time": null, "api_group": "BE-PY-001-Fetch data privacy setting", "details": "Bad Gateway", "updated_at": "2024-08-23T23:21:32.572124+01:00" }, ] }
### Post API Status - Success Response - #### Code: 201 CREATED - #### Content: ```json { "status_code": 201, "success": true, "message": "API Status created successfully", "data": { "last_checked": "2024-08-23T20:54:44.092052+01:00", "id": "066c8e35-2ac5-786b-8000-87167f0401ca", "created_at": "2024-08-23T20:30:26.672906+01:00", "response_time": null, "status": "Down", "api_group": "Blog API", "details": "API not responding (HTTP 503)", "updated_at": "2024-08-23T20:54:44.092052+01:00" } }
{ "errors": { "field": "<field>", "message": "<message>" } }
{ "error": "An unexpected error occurred" }
curl -X GET "https://<base-url>/api/v1/api-status" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <your_jwt_token>"
curl -X POST "https://<base-url>/api/v1/api-status" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer <your_jwt_token>" \ -d '{ "api_group": "Authentication API", "status": "Operational", "response_time": 320, "details": "All tests passed" }'
Description
Develop API endpoints to retrieve and update the details of API status. The following endpoints should be created:
Acceptance Criteria
Fetch API Status
POST API Status
Purpose
Requirements
Expected Outcome
Tasks
/api/v1/api-status
to retrieve the API status details./api/v1/api-status
to accept updates for API statuses.Database Schema
Endpoint URLs
Fetch API Status
/api/v1/api-status
Post API Status
/api/v1/api-status
Responses
Fetch API Status - Success Response
Code: 200 SUCCESS
Content:
Error Responses
Code: 422: UNPROCESSABLE CONTENT / VALIDATION ERROR
Content:
Code: 500 INTERNAL SERVER ERROR
Content:
Example Request
Fetch API Status
Post API Status