Why Some Companies Force All APIs to Use POST – Benefits, Drawbacks, and Best Practices
This article examines the reasons behind mandating POST for all API endpoints, compares GET and POST characteristics, discusses the practical implications of such a policy, and offers guidance on when each HTTP method is appropriate for backend development.
Background
While browsing Zhihu, a question arose: why do some companies require every API to use the POST method? The author reflects on past experiences with microservice projects and RESTful conventions, noting that this rule often stems from internal policies rather than technical necessity.
GET vs POST Differences
POST is more secure because data is not part of the URL, avoiding caching, server logs, and browser history.
POST can transmit larger payloads, as GET URLs have length limits.
POST supports more data types, whereas GET is limited to ASCII characters.
POST is generally slower than GET.
POST is used for creating, updating, or deleting data; GET is typically for searching, sorting, or filtering.
GET requests for static resources can be cached; data requests are not cached.
These distinctions show that POST excels for large or complex data submissions, while GET is suited for retrieving static resources or simple queries.
Should All APIs Use POST?
The author prefers using GET for simple queries and POST for modifications, deletions, or complex queries, rather than enforcing POST universally. Community comments highlight various perspectives: some argue that strict POST usage simplifies tooling like Swagger, while others point out the drawbacks of forcing a uniform method on diverse business actions.
Practical Considerations
Enforcing a single HTTP method can lead to misunderstandings, increased monitoring complexity, and extra overhead in documentation and tooling. While RESTful conventions provide benefits such as clear semantics, resource-oriented design, and cache utilization, they also introduce costs like forced abstraction, path complexity, and potential cache mismanagement.
Ultimately, the choice of HTTP method should align with business needs, performance requirements, and maintainability. Companies should evaluate whether a universal POST policy truly reduces costs and improves efficiency, or if a balanced approach better serves their architecture.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
