REST API using POST instead of GET

前端 未结 8 785
野趣味
野趣味 2020-12-04 07:17

Let\'s assume a service offers some funcionality that I can use like this:

GET /service/function?param1=value1¶m2=value2

Is it righ

8条回答
  •  攒了一身酷
    2020-12-04 07:58

    If I understand the question correctly, he needs to perform a REST GET action, but wonders if it's OK to send in data via HTTP POST method.

    As Scott had nicely laid out in his answer earlier, there are many good reasons to POST input data. IMHO it should be done this way, if quality of solution is the top priority.

    A while back we created an REST API to authenticate users, taking username/password and returning an access token. The API is encrypted under TLS, but exposed to public internet. After evaluating different options, we chose HTTP POST for the REST method of "GET access token," because that's the only way to meet security standards.

提交回复
热议问题