Middle
What would you say about an API where all methods are implemented via POST (no GET, PUT, PATCH, DELETE)?
sobes.tech AI
Answer from AI
Using only POST for all API methods is a violation of REST principles and HTTP standards. In REST, each HTTP method has its semantic meaning:
- GET — retrieving data (without side effects)
- POST — creating resources or performing actions
- PUT/PATCH — updating resources
- DELETE — deleting resources
If all methods are implemented via POST, it leads to:
- Loss of semantics and clarity of the API
- Caching issues (GET requests are usually cached, POST — not)
- Difficulties with debugging and integration
- Violation of idempotency (GET, PUT, DELETE are usually idempotent, POST — not)
This approach may be justified in some cases (for example, client restrictions, proxies, or firewalls), but overall it is a bad practice. It is better to use methods as intended for convenience, performance, and compliance with standards.