I was wondering if I should use a GET or a POST method for a particular endpoint:
The purpose of the endpoint is to verify a user's email address.
In order to do so, I have a simple single field form asking for the user's address. The user submits the form and I send him an email containing a token for his email confirmation (see JWT Email Validation Protocol). No information is stored on the server side, no state is saved or modified. I was wondering what should the HTTP method be for this kind of endpoint.
I set it to POST in the beginning but as it doesn't change any state on the server, I thought that it could be a GET request.
A more general question would be: Should every requests that don't modify a database or change anything server side be a GET request ?
Or: Should every POST requests be used only when you send data that needs to be stored on the server?
question from:
https://stackoverflow.com/questions/65901713/get-requests-for-stateless-endpoints 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…