阅读了大量定义GET / POST / PUT / DELETE各种解释的网站后,我感到有些困惑。经过深入阅读后,我相信我现在明白了,但如果有人能够证实我是否走在正确的轨道上会很有用。
以下解释了我对REST操作的理解:
GET - get data
POST - create or update **entire or part** resource at non-specific entity URI
PUT - create or update **entire** resource at specific entity URI
DELETE - delete entity at specific entity URI
REST URI的一些示例:
/api/user
POST - create a new user and respond with unique user ID
/api/user/{id}
GET - get data for specific user
POST - update some or all user data
PUT - create or replace entire user
DELETE - delete specific user
/api/user/{id}/profile
GET - get data for user profile
POST - update some or all user profile data
PUT - create or replace entire user profile
/api/users
GET - perform query to retrieve listing of user data
我是否沿着正确的路线走?有什么重要的我应该知道/阅读吗?