mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-05-19 12:50:11 -05:00
9547937be2
- Simplify README version section and point to CHANGELOG - Update UI overview with Reports and installation reference - Refresh CONTRIBUTING, DEVELOPMENT, API.md links/consistency - Add ARCHITECTURE_AUDIT, DOCS_AUDIT, PRODUCT_UX_AUDIT, FRONTEND, PERFORMANCE - Add API_CONSISTENCY_AUDIT, RESPONSE_FORMAT, CONTRIBUTOR_GUIDE, TESTING_STRATEGY - Update GETTING_STARTED, REST_API, PROJECT_STRUCTURE, DEPLOYMENT_GUIDE
1.4 KiB
1.4 KiB
API Response Format
Standard envelope (errors)
All API v1 error responses use a consistent shape from app.utils.api_responses:
- Error response:
{ "success": false, "error": "<error_code>", "message": "<message>", "errors"?: {...}, "details"?: {...} } - Validation errors:
error_codeis"validation_error";errorscontains field-specific messages. - Common error codes:
not_found,forbidden,unauthorized,validation_error,error.
HTTP status codes: 400 (bad request/validation), 401 (unauthorized), 403 (forbidden), 404 (not found), 409 (conflict), 422 (unprocessable), 500 (server error).
Success responses
- Preferred (standard envelope):
{ "success": true, "data": <payload>, "message"?: "<message>", "meta"?: {...} } - Legacy (resource-keyed): Many list/get endpoints return
{ "projects": [...] },{ "project": {...} },{ "invoices": [...], "pagination": {...} }without a top-levelsuccessordatawrapper. This is kept for backward compatibility. - New endpoints should use
success_response(data=...)so the payload is underdataandsuccess: trueis set.
Pagination
When using paginated_response(), the response is { "success": true, "data": <items>, "meta": { "pagination": { "page", "per_page", "total", "pages", ... } } }. Some list endpoints still return { "<resource>": [...], "pagination": {...} } for compatibility.