REST API - what is it? REST: translation. Representational State Transfer

Table of contents:

REST API - what is it? REST: translation. Representational State Transfer
REST API - what is it? REST: translation. Representational State Transfer
Anonim

REST API (Representational State Transfer), or RESTful web services - what is it? REST is translated from English as “representative state transfer”. It is a way of providing communication between computer systems on the Internet. REST-compliant web services that allow requesting systems to access and manipulate textual representations of web resources using a single and predefined set of operations. There are other forms of web services that contain their own arbitrary set of operations, such as WSDL and SOAP.

REST API: what is it? Definition of concept

Web resources were originally defined on the World Wide Web as documents or files identified by their URLs. Today they have a much more general and abstract definition, encompassing every item or entity that can be identified, named, addressed or processed on the Web. In a REST API web service, requests poisoned into a URI-resource call a response, which can be formatted in XML, HTML, JSON, or some other format. The response can confirm that some changes have been made to the stored resource, and provide hypertext links to other related resources and their collections. The use of HTTP as the most common protocol refers to the types of available operations that are predefined by the PUT, DELETE, HTTP GET, POST commands.

Using stateless protocols and standard operations, REST systems aim for fast performance, reliability, and scalability by reusing components that can be managed and updated without affecting the overall system. Using REST is often preferred over the heavier SOAP (Simple Object Access Protocol) style because REST does not use bandwidth, making it more suitable for use on the web. The SOAP approach requires writing or using a provided server program (to serve data) and a client program (to request data).

rest api what is it
rest api what is it

History of Technology

The term "representational state transfer" was introduced and defined in 2000 by Roy Fielding in his dissertation "Architectural Styles and Design of Software Network Architectures". It developed the REST architectural style in parallel with HTTP 1.1 from 1996-1999, based on the existing 1996 HTTP 1.0 draft. In a retrospective look at the development of technology, Fielding said that throughout the processThe HTTP standardization was intended to protect design choices on the web. This is a very difficult task within the process of accepting proposals from anyone on a topic that is quickly becoming the center of the entire industry.

Fielding had comments from over 500 developers, many of whom are great engineers with years of experience. He had to explain everything from the most abstract concepts of web interaction to the precise details of HTTP syntax. This process honed his model to a core set of principles, properties, and constraints now called REST.

rest api authorization
rest api authorization

Benefits

REST style features affect the following architectural properties:

  • Performance - Component interaction is the dominant feature in user perception of network performance and effectiveness.
  • Scalable to support the maximum number of components, REST API testing and interaction between them.
  • Easy single interface and authorization REST API.
  • Modifiable components to meet changing needs (even while the application is running).
  • Visibility of connection between components and service agents.
  • The ability to move components by moving their program code with data.
  • Reliability - high fault tolerance in the presence of failures in the composition, connectors or data.
rest translation
rest translation

Due to the separation of concerns between clients in that this REST API allowssimplify the implementation of components, reduce the complexity of the connector semantics, increase the efficiency of performance tuning, and increase the scalability of pure server components. Sophisticated system constraints allow proxies, gateways, and firewalls to be deployed at different communication points without changing the interfaces between components, allowing them to perform REST message translation or improve performance with large-scale shared caching. An example of a REST API is the fact that interaction is stateless of requests, standard methods and media types are used to indicate semantics and information exchange, and responses explicitly indicate cacheability.

Formal and architectural constraints

Six guiding constraints characterize a RESTful system. They restrict the ways the server can process and accept client requests. By operating within these constraints, the service achieves desired non-functional properties such as performance, scalability, simplicity, variability, visibility, portability, and reliability. If the service violates any of the required restrictions, it cannot be considered RESTful.

The first restrictions relate to the client-server architectural style. Separating user interface concerns from data storage concerns improves the portability of the user interface across multiple platforms. It also improves scalability by simplifying server components. Perhaps most significant to the Web is that separation allows components to evolve.independently, thereby supporting the requirements of Internet scale for multiple organizational domains.

representational state transfer
representational state transfer

Safety

REST does not provide built-in security support. This is very important when designing REST web services - security and design requirements are met up front. REST web services use HTTP GET, POST, PUT and DELETE from CRUD operations. PUT and DELETE are not supported by many browsers and are most often disabled at the server level due to potential privacy concerns. If it is not configured properly at the server and client levels, any unauthorized user will be able to create a resource using the PUT method or destroy the DELETE resource in use. When developing security requirements for web services, these points should be taken into account.

rest api examples
rest api examples

Architectural elements

A key aspect of REST is the nature and state of its data elements. There are four concepts in the REST style that describe the behavior and state of information.

A resource is an object (logical or physical) available on the Internet. This can be a document stored on the server's file system or a row in a database table. An end user interacts with a resource to achieve a specific goal. To design a system with REST, a developer must think about business objects as resources and how they can be addressed.

rest api java
rest api java

URI - uniquely identifies a resource. This settingmakes the resource addressable and can be changed. Resources are modified using an application protocol - such as

View is the data/metadata of the state of a resource at a point in time. The client receives a resource representation when requesting a URI. The resource kind can be encoded in one or more transferable formats such as XML, HTML, JSON, RSS, REST API java. These formats can be negotiated using the content negotiation mechanism.

Link - Allows an application to transition from one state to another. Each resource must be connected to other resources. The view should offer a link to the next transition. A well-connected application allows the user to open the interface on their own.

Connector

A connector connector is an abstract interface that mediates communication between components. Because REST interactions are stateless, the connector does not need to store state information. Therefore, communication between components can occur in parallel.

rest api requests
rest api requests

Client and server are the main REST connectors. The client initiates the request and the server processes it.

Cache is another kind of slot. Caching can be implemented at the client, server or intermediate levels. This reduces latency and network usage.

Components

Components execute a set of well-defined methods on a resource that creates a view to capture the current or intended state.

User-Agent -uses the client connector to initiate the request.

Origin-server - uses the server connector to answer the request.

Proxy is an intermediary used on the client side to provide interface encapsulation by other services. It also performs data translation and protection.

Gateway - an intermediary used on the server to provide interface encapsulation by other services.

Prospects for development

The question is always relevant: REST API - what is it for modern Internet technologies? REST is the basis of modern web architecture, which is developed by analyzing the shortcomings of existing styles and introducing new additions to it.

REST API goals - what is it? It is the desire to use existing styles with a coordinated set of constraints to minimize network communication and maximize the independent evolution of components to achieve scalability. This is a new architecture for a distributed hypermedia system. With the advent of smartphones, tablets, etc. gadgets, the network and its scalability will be introduced.

Popular topic

Editor's choice

  • How to block a person in "Contact"? Protect your page from ill-wishers
    How to block a person in "Contact"? Protect your page from ill-wishers

    The popularity of social networks is increasing every day. This is due to the fact that such an instrument of mass communication has entered everyday life and firmly established itself in it, as one of the most convenient ways of communication. Almost every advanced person has his own page on the social network, where he posts his photos, posts posts and, most importantly, communicates with friends and makes new acquaintances

  • Why doesn't "VK" work? The VKontakte website is not working: what to do?
    Why doesn't "VK" work? The VKontakte website is not working: what to do?

    Social media addiction is considered one of the most serious cyber diseases. Every day, tens of millions of users around the globe visit their personal accounts, chatting with friends, discussing the latest events in the world. Social networks have become such a dense part of our lives that it seems unusual to spend a day without looking at them even for a second

  • What is button accordion? Learn slang online
    What is button accordion? Learn slang online

    The Internet is a territory with its own rules, language, style of communication, and, more recently, laws. It so happened that many new users may be left at a loss after communicating with hardened Internet - "hacks". We are talking, first of all, about the use of slang by the latter in their language, which is far from accessible to everyone who opened the page of any forum for the first time

  • Hashtag - what is it? How to use hashtags
    Hashtag - what is it? How to use hashtags

    The Internet is constantly progressing, and every day new features appear in it that make working on it more convenient. They are associated, as a rule, with the optimization and structuring of information, since there is such a large amount of it on the World Wide Web that it is sometimes difficult to find the necessary material. For example, in the recent past, so-called hashtags appeared

  • Why is the internet slow? The most important reasons
    Why is the internet slow? The most important reasons

    In the last couple of years, the Internet has become an important part of the life of almost every person. Using the World Wide Web, we can find out the weather, the latest world news, download the necessary programs, play online games, etc. When the Internet is working well, doing the above things is very nice, but what if all of a sudden web pages start to load for a very long time, and online games slow down?