What is a sub resource?

What is a sub resource?

A resource’s critical subresources are those that the resource needs to have available to be correctly processed. To answer your question a subresource is everything that has to be fetched after the html has been parsed like scripts, stylesheets, images, videos..

What is RESTful API for?

A REST API (also known as RESTful API) is an application programming interface (API or web API) that conforms to the constraints of REST architectural style and allows for interaction with RESTful web services. REST stands for representational state transfer and was created by computer scientist Roy Fielding.

Is Hateoas dead?

HATEOAS – the concept of using hypermedia as the engine of application state is dead. Numerous companies have tried to incorporate hypermedia, and only a few have succeeded – but at what cost and what benefit.

Do you have to use nested resources in REST API?

While nesting is sometimes necessary and can’t be avoided, it is often a choice that comes with specific costs or dangers we should keep in mind. Let’s look at them one-by-one. We learned before that nesting resources could make our URLs more readable, but this isn’t a sure bet.

Is it always the best solution to manage nested resources?

In case the API user required more information about nested resources or lists of sub-resources, they could simply make another API call. But, is this always the best solution? To find the answer, we carried out a client analysis to ascertain what clients’ needs were in different cases.

Why do we use a nested resource URL?

Why should we use this approach: The main reason for this approach is readability; a nested resource URL can convey that one resource belongs to another one. It gives the appearance of a hierarchical relationship, like directories give in file-systems. These URLs convey less meaning about the relationship:

How are representations returned in a REST API?

Multiple endpoints that return the same representations can also lead to problems with caching and can violate one of the core principles of RESTful API design. This problem can be solved via HTTP redirects, so all representations are returned from a central root resource and can be cached, but there is still code needed to implement this.