The goal of this article is to show off elements of the web architecture that are fundamental pieces of REST architecture.

REST is not just a guide of best practices and semantics for building APIs, but rather a** hybrid style architecture, principles, and constraints!** 💁

REST AND THE WORLD WIDE WEB ARCHITECTURE

To better understand how REST works, you need to understand some fundamental REST-related web architecture principles, which are:

  • Resources and Representations
  • Addressing of resources (addressability)
  • Uniform Interface
  • Stateless
  • Hyperlink for navigation between resources (Hypermedia)

Resources and Representations

Whenever we make a request to a server, it is made through a Uniform Resource Locator, which is a URL for a thing, e.g., a product, a photo, or a homepage. In REST terms, that “thing” is known as a resource.

When the browser requests to obtain a resource, the server sends a document as a response, which may vary according to what was requested, which may be an HTML document, binaries containing the requested image, or plain text in JSON format.

Regardless of the type of document returned, we name this document asa representation of the resource.👈❕

In summary, the customer never sees the resource directly, but rather a representation of it, which is identified by a URL, and a resource can contain multiple representations.

Addressability

Everything on the web is “addressable” which means that everything should have a reference to it. Every resource must have its URL, which is used to access only one of its representations. Each different representation of a resource must provide its URL.

The addressing principle simply says that each resource must have its own URL. If something is important to your application, must have a unique name, and a unique URL.

Despite common misconceptions, REST is not about how to either build or design API routes, but it is so important to understand how to design API routes. At the end of this article, I have linked a sample RESTful API project that to show off in practical everything related in this article, plus route design considerations.

#rest-api #api #rest #deep-learning

How to build a RESTful API — A Deep Dive into REST APIs
2.35 GEEK