When should an API request use GET rather than POST?
Quick answer
Use GET when you want to retrieve a resource without asking the server to change it. Use POST when you send data for the server to process, which may cause a state change or another effect. HTTP classifies GET as safe and idempotent; POST is not safe or idempotent by default. Check the API documentation because individual endpoints may follow specific conventions. [S1] [S2]
The question, the details, the next step.
A practical checklist
Identify whether the operation retrieves data or sends data for processing.
Use GET for retrieval when the endpoint documentation supports it.
Use POST for submitted data when the endpoint documents that processing behavior.
Check the documented effects before repeating a POST.
Confirm each endpoint’s method, parameters, and behavior in its API documentation.
A few more useful answers
Can a GET request change data if an API allows it?
GET is defined for retrieval, not for requesting a change. Follow the endpoint documentation, but don’t treat an API-specific convention as GET’s general purpose. [S1]
Is it always safe to repeat a POST?
No. POST is not classified as safe or idempotent by default, and repeating an identical request may have additional effects. Check the specific endpoint’s documentation. [S2]
Sources
References used for this guide.
- [S1] GET request method — HTTP | MDN developer.mozilla.org · Checked
- [S2] POST request method — HTTP | MDN developer.mozilla.org · Checked
