Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 772
Chiron Avatar asked Sep 19 '12 17:09

Chiron


People also ask

Which character in URI path portion indicates a hierarchical relationship between REST resources?

The forward slash (/) character is used in the path portion of the URI to indicate a hierarchical relationship between resources.

Which URL pattern is recommended when working with one resources and a collection of resources?

URL Structure The recommended convention for URLs is to use alternate collection / resource path segments, relative to the API entry point.

What is URI in REST API?

Each resource in REST architecture is identified by its URI (Uniform Resource Identifier). A URI is of the following format − <protocol>://<service-name>/<ResourceType>/<ResourceID> Purpose of an URI is to locate a resource(s) on the server hosting the web service.

What is the recommended term used to refer to multiple resources in API?

In this case, we refer to these resources as singleton resources. Collections are themselves resources as well. Collections can exist globally, at the top level of an API, but can also be contained inside a single resource. In the latter case, we refer to these collections as sub-collections.


1 Answers

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.

like image 66
JDwyer Avatar answered Oct 20 '22 23:10

JDwyer