How “store” REST archetype isn't creating a new resource and a new URI?

浪子不回头ぞ 提交于 2019-12-21 02:34:05

问题


REST API design indicates there are four resources archetypes: document, collection, store and controller.

Store do not create new resources; therefore a store never generates new URIs.

An example:

PUT /users/12245/favorites/boston-celtics

A user added Boston Celtics to his favorites list.

But how that isn't creating a new resource ? and how it isnt generating a new URI?


回答1:


A store does not create a resource on its own. The user of the store creates endpoints / URIs.

The contrast is between a Collection and a Store

Collection A collection resource is a server-managed directory of resources. Clients may propose new resources to be added to a collection. However, it is up to the collection to choose to create a new resource, or not. A collection resource chooses what it wants to contain and also decides the URIs of each contained resource.

Store A store is a client-managed resource repository. A store resource lets an API client: put resources in, get them back out, and decide when to delete them.



来源:https://stackoverflow.com/questions/12500248/how-store-rest-archetype-isnt-creating-a-new-resource-and-a-new-uri

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!