REST - get a random number GET or POST?

后端 未结 3 1753
梦毁少年i
梦毁少年i 2021-02-14 10:36

How should a random number generator properly be implemented in REST?

GET   RANDOM/

or..

POST  RANDOM/

The se

3条回答
  •  南笙
    南笙 (楼主)
    2021-02-14 11:31

    • definition of REST-call with GET: the result have to be the same -> not GET.
    • definition of REST-call with PUT: the result of the call can be repeatable, the server should not have problem with it -> use PUT

    POST is the weakest method and can used if other are not useful.

    Why not GET: the result of GET-call can be cachet (cache-header, etag oder transparent proxies) and you dont will get random results ...

提交回复
热议问题