REST verbs - which convention is “correct”

前端 未结 7 2399
有刺的猬
有刺的猬 2020-12-25 13:20

I\'m well into implementing a REST service (on a Windows CE platform if that matters) and I started out using IBM\'s general definitions of using POST for creating (INSERTs)

相关标签:
7条回答
  • 2020-12-25 14:19

    The verbs are:

    GET {path}: Retrieve the resource whose identifier is {path}.

    PUT {path}: Create or update the resource whose identifier is {path}.

    DELETE {path}: Delete the resource whose identifier is {path}.

    POST {path}: Invoke an action which is identified by {path}.

    When the intention is to create a new resource, we can use PUT if we know what the identifier of the resource should be, and we can use POST if we want the server to determine the identifier of the new resource.

    0 讨论(0)
提交回复
热议问题