POST or GET for a validation of some data endpoint in REST?

試著忘記壹切 提交于 2019-12-12 04:21:50

问题


I have a server endpoint which validates some data and return true/false if the data validation has no errors.

So which Version would be correct or more suitable for a RESTful webservice?

POST https://server.de/validate

POST data in body and return HTTP status code 200 if validation had no errors or

GET https://server.de/validate?=data

Send data in header or query parameter and return true/false in the response (Status code 200 would be returned after a correct request, independent of the data validation).


回答1:


You should always use POST if the information is sensitive.

Read This thread for more information there are many similar question with yours if you search:

Edit/Update: a good source for seeing the difference



来源:https://stackoverflow.com/questions/41673005/post-or-get-for-a-validation-of-some-data-endpoint-in-rest

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!