Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
364 views
in Technique[技术] by (71.8m points)

api - Get requests for stateless endpoints

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...