0

我是 RESTful 架构的初学者,对此我有一些疑问。我已经理解了主要思想:动词和资源。但我真的不知道应该为我的 Web 应用程序项目使用什么 URI。

-> 我应该使用什么 URI 来获取诸如订阅/注册页面(以创建新用户)之类的页面,或任何其他能够创建新资源的页面。

我应该这样做:GET webiste.com/user/new 还是:GET website.com/subscription

谢谢你。

4

1 回答 1

1

要创建新对象,它应该使用 POST,例如:

POST website.com/users
POST website.com/subscriptions

GET 应该用于检索/读取,例如:

GET website.com/users?name=adam
GET website.com/users/35 (get user with id of 35)
GET website.com/users (get all users)
于 2013-05-26T15:43:56.553 回答