Home » Resources

Resources

So what is a resource?

The key abstraction of information in REST is a resource. Any information that can be named can be a resource: a document or image, a temporal service (e.g. “today’s weather in Los Angeles”), a collection of other resources, a non-virtual object (e.g., a person), and so on. In other words, any concept that might be the target of an author’s hypertext reference must fit within the definition of a resource. A resource is a conceptual mapping to a set of entities, not the entity that corresponds to the mapping at any particular point in time. https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#sec_5_2_1_1

In enterprise software, the resources are usually the entities from the business domain (e.g. customers, orders, products). On an implementation level, it is often the database tables (with business logic on top) that are exposed as resources. https://www.kennethlange.com/books/The-Little-Book-on-REST-Services.pdf (p.8)

A resource can be anything at all: a pomegranate, a human being, the color black, the concept of courage, the relationship between mother and daughter, or the set of all prime numbers. The only restriction is that every resource must have a URL. https://restapilinks.com/wp-content/uploads/2021/04/RESTful_Web_APIs.pdf (p.30)

A resource should have an associated URI if another party might reasonably want to create a hypertext link to it, make or refute assertions about it, retrieve or cache a representation of it, include all or part of it by reference into another representation, annotate it, or perform other operations on it, you should make it a resource. https://www.w3.org/TR/2004/REC-webarch-20041215/#uri-benefits

For real-world resources, such as goods in a warehouse, we can distinguish between the actual object and the logical information resource encapsulated by an application or service. It’s the information resource that is made available to interested parties through projecting its representations onto the Web. By distinguishing between the “real” and the “information” resource, we recognize that objects in the real world can have properties that are not captured in any of their representations. https://restapilinks.com/wp-content/uploads/2021/04/REST_in_Practice_by_Ian_Robinson.pdf (p.8)

The fundamental concept in any RESTful API is the resource. A resource is an object with a type, associated data, relationships to other resources, and a set of methods that operate on it. It is similar to an object instance in an object-oriented programming language, with the important difference that only a few standard methods (GET, POST, PUT & DELETE) are defined for the resource https://restful-api-design.readthedocs.io/en/latest/resources.html


Resource Resource concept
Fielding’s thesis part https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm#tab_5_1 (5.2.1.1.)
Resource Modeling https://www.thoughtworks.com/insights/blog/rest-api-design-resource-modeling
Controller vs Document https://www.gcloud.belgium.be/rest/#controller-vs-document
Resource Archetypes https://restapilinks.com/wp-content/uploads/2021/04/REST-API-Design-Rulebook.pdf (p.15)