REST - Architecture That Makes It Easy for You to Understand the API

REST - Architecture That Makes It Easy for You to Understand the API

When you want to understand the API documentation and use it effectively, the first thing you need to understand is REST.

There’s a good chance you’ve come across this term if you’re thinking of getting your data from other sources on the internet, like Twitter or Github.

However, what is REST? What are the benefits for you? How do you use it? Check out the full explanation in the following article. Let’s get started!

Getting Started

REST is an acronym for REpresentational State Transfer. It is an architectural style for distributed hypermedia systems and was first presented by Roy Fielding in 2000 in his famous dissertation.

According to Code Academy, REST-compliant systems, often called RESTful systems, are characterized by their statelessness and separate the concerns of client and server.

Stateless means that the server does not need to know anything about the state of the client and vice versa. Thus, both the server and the client can understand any message received, without even seeing the previous message.

In the REST architectural style, client implementation and server implementation can be done independently without knowing each other.

This means that the code on the client-side can be changed at any time without affecting the operation of the server, and the code on the server-side can be changed without affecting the operation of the client.

REST uses a standard set of request methods including GET, POST, PUT, DELETE, and other existing HTTP capabilities.

In essence, REST consists of the following four things:

  • Resources referenced by global identifiers such as URIs.
  • Representation of resources, namely documents that contain information on the required resources.
  • Components that communicate with each other between the client and the server.
  • A standard interface that identifies resources, allows manipulation of resources through representations, includes self-descriptive messages describing how to process requests and responses, and dynamically identified hypermedia.

Basic Principles of REST

According to the REST API, there are six basic principles of REST.

1. Client-server

The first basic principle of REST is client-server, by separating user interface problems from data storage problems.

By separating these issues, you can improve user interface portability across multiple platforms and increase scalability by simplifying server components.

2. Stateless

The second basic principle of REST is stateless. This principle makes it easy to access information from the client to the server and vice versa.

Each request from the client to the server must contain all the information necessary to understand the request, and cannot take advantage of the context stored on the server.

Therefore, the session state is stored entirely on the client.

3. Cacheable

Cache constraints require that data in response to requests be labeled implicitly or explicitly as cacheable or non-cacheable.

If the response can be cached, the client cache is granted the right to reuse the response data for an equivalent request later.

4. Uniform interface

A uniform interface is created by applying the general principles of software engineering to the component interfaces, the overall system architecture is simplified and the interaction visibility is improved.

In order to obtain a uniform interface, some architectural constraints are required to guide the behavior of the components.

  • REST is defined by four interface constraints.
  • resource identification
  • resource manipulation through representation
  • self descriptive message
  • hypermedia as an application state engine

5. Layered system

The next basic principle of REST is a layered system. The layered system style allows the architecture to consist of hierarchical layers by limiting the behavior of the components in such away.

Thus, individual components cannot “see” beyond the immediate layer they interact with.

6. Code on demand (optional)

REST allows client functionality to be extended by downloading and running code in the form of applets or scripts.

This simplifies the client by reducing the number of features required to pre-implement.

Advantages of Using REST

1. Separation between client and server

The REST protocol completely separates the user interface from the server and data storage. This has several advantages when doing development.

For example, increasing the portability of the interface to other types of platforms, increasing project scalability and allowing various development components to be developed independently.

2. Visibility, reliability, and scalability

The separation between client and server has one real advantage, which is that any development team can scale the product without too much trouble.

They can migrate to another server or make all kinds of changes in the database, as long as the data from each request is sent correctly.

The separation makes it easier to have the front and back on different servers, and it makes the application more flexible to use.

3. REST is always independent of platform type or programming language

REST always adapts to the type of syntax or platform used, which gives a lot of freedom when changing or testing new environments in development.

Using REST, you can have a PHP, Java, Python, or Node.js server.

The only thing to note about REST is that responses to requests must always be in the language used for exchanging information, usually XML or JSON.

Disadvantages of Using REST

Some of the problems with REST are not inherent in architectural style, but rather the drawbacks of implementing REST over HTTP.

The most notable problem with REST is that lo-rest uses only GET and POST.

While technically it may still be RESTful, a uniform interface sometimes doesn’t really help the user.

One problem that is not specific to HTTP is that handling the programming language used for REST is not resource-oriented so the handling code that maps URIs tends to be messy.

In fact, Microsoft did a relatively good job of implementing Joe Gregorio’s URI mapping idea which helped alleviate some of the problems.

But on the other hand, it is relatively difficult to make REST with hyper-text driven so that it becomes an obstacle for REST.

Lastly and most importantly, REST is not the answer to everything. Most REST implementations don’t support the idea of ​​pub/sub

REST may be a great tool for your device, but it’s not the only solution.

You can also watch an explanation video about REST below


That’s the explanation about REST. We have seen what rest is, the basic principles of REST, the advantages and disadvantages of REST. Interested in web development concepts? You can also read other articles on this Artistudio Wikis. If it’s useful, don’t forget to share this article with your friends. Thank you very much 🙂


Sharing is caring

© 2023 All Rights Reserved by Artistudio

Website problem, contact us!