This document outlines the conversion of non-RESTful endpoints to proper REST API standards, including time estimates for each endpoint. The conversion will improve API consistency, maintainability, and adherence to REST principles.
GET /api/find/{collection}GET /api/{collection}OnlineCrudService.find() method to use new endpointGET /api/find-by-id/{collection}/{id}GET /api/{collection}/{id}OnlineCrudService.findById() methodGET /api/find-by-user-id/{collection}/{userId}GET /api/{collection}?user_id={userId}GET /api/{collection}/user/{userId} (if user_id is a resource identifier)
UserDetailsService.findByUserId())GET /api/find-by-value/{collection}/{name}/{value}GET /api/{collection}?{name}={value}OnlineCrudService.findByValue() method to build query stringPOST /api/find-by-value-set/{collection} (with body containing field name and array of values)POST /api/{collection}/search RecommendedGET /api/{collection}?{name}[]={value1}&{name}[]={value2}
OnlineCrudService.findByValue() method when value is ListPUT /api/put/{collection} (with id in body)PUT /api/{collection}/{id} (id in URL path)OnlineCrudService.save() method to include id in URL when updatingDELETE /api/delete/{collection}/{id}DELETE /api/{collection}/{id}OnlineCrudService.delete() methodPOST /api/delete-link-table/{collection} (with link data in body)DELETE /api/{collection}/links RecommendedPOST /api/{collection}/links/delete (if DELETE with body is not supported)
OnlineCrudService.deleteFromLinkTable() methodPOST /api/post-link-table/{collection}POST /api/{collection}/linksOnlineCrudService.saveToLinkTable() methodPOST /api/post/{collection}POST /api/{collection}OnlineCrudService.save() method (create operation)POST /api/uploadFile/{key} (multipart form data)POST /api/files/upload RecommendedPOST /api/{collection}/files (collection-specific uploads)
HttpService.postFile() methodfind/{collection} → GET /api/{collection}find-by-id/{collection}/{id} → GET /api/{collection}/{id}delete/{collection}/{id} → DELETE /api/{collection}/{id}post/{collection} → POST /api/{collection}post-link-table/{collection} → POST /api/{collection}/linksput/{collection} → PUT /api/{collection}/{id}find-by-user-id/{collection}/{userId} → GET /api/{collection}?user_id={userId}find-by-value/{collection}/{name}/{value} → GET /api/{collection}?{name}={value}delete-link-table/{collection} → DELETE /api/{collection}/linksfind-by-value-set/{collection} → POST /api/{collection}/searchuploadFile/{key} → POST /api/files/upload/api/v1/{collection} for future-proofingBackend (PHP/CodeIgniter):
Frontend (Flutter/Dart):
lib/services/http_service.dart - Base HTTP methodslib/services/online_crud_service.dart - Main CRUD serviceOnlineCrudService or LocalCrudServicelib/services/file_service.dart - File upload service| # | Method | Current Endpoint | Proposed Endpoint | Complexity | Estimate (Hours) | Phase |
|---|---|---|---|---|---|---|
| 1 | GET | find/{collection} | {collection} | Low | 2-3 | Phase 1 |
| 2 | GET | find-by-id/{collection}/{id} | {collection}/{id} | Low | 2-3 | Phase 1 |
| 3 | GET | find-by-user-id/{collection}/{userId} | {collection}?user_id={userId} | Medium | 3-4 | Phase 2 |
| 4 | GET | find-by-value/{collection}/{name}/{value} | {collection}?{name}={value} | Medium | 4-5 | Phase 2 |
| 5 | POST | find-by-value-set/{collection} | {collection}/search | High | 5-6 | Phase 3 |
| 6 | PUT | put/{collection} | {collection}/{id} | Medium | 3-4 | Phase 2 |
| 7 | DELETE | delete/{collection}/{id} | {collection}/{id} | Low | 2-3 | Phase 1 |
| 8 | DELETE | delete-link-table/{collection} | {collection}/links | Medium | 3-4 | Phase 2 |
| 9 | POST | post-link-table/{collection} | {collection}/links | Low | 2-3 | Phase 1 |
| 10 | POST | post/{collection} | {collection} | Low | 2-3 | Phase 1 |
| 11 | POST | uploadFile/{key} | files/upload | Medium | 3-4 | Phase 3 |
| Total Estimated Time: | 31-40 hours | |||||