All original content is created in Ukrainian. Not all content has been translated yet. Some posts may only be available in Ukrainian.Learn more

What is a REST API? The basic principles of REST and GET, POST, PUT, PATCH, DELETE.

This content has been automatically translated from Ukrainian.
REST API (Representational State Transfer Application Programming Interface) is a software architecture style for interaction between components of a web system. REST uses standard protocols such as HTTP to transfer data between the client and the server. The main principles of REST include statelessness, caching, distributed systems, and others.

Statelessness

Each request from the client to the server must contain all the necessary information to understand and execute that request. The server should not store the client's state between requests. Each client request is treated independently, without dependence on previous requests.

Caching

REST systems can use caching mechanisms to store copies of resources on the client or intermediary server. This helps reduce the number of requests to the server and improve performance.

Distributed Systems

REST is designed for use in distributed systems (the Internet is an example of such a system). Resources can be located on different servers, and the client can access them using standard protocols such as HTTP.

Uniform Interface

In a REST system, the interface to each resource must be uniform. This means that there is a standard way to interact with each resource, regardless of how it is stored or processed on the server. Interaction with resources is carried out through a unified set of methods (GET, POST, PUT, DELETE) and standard resource concepts.

Navigation and Interaction with Resources

REST also supports hypermedia, allowing the client to receive dynamic information about available actions and resources during interaction with the server.
The main actions performed on resources using the REST API are GET, POST, PUT, PATCH, DELETE.

Retrieving Resources (GET)

The client can use an HTTP GET request to retrieve information about a resource. For example, retrieving a list of users, article details, etc.

Creating Resources (POST)

This type of request is used to create a new resource. For example, adding a new user to the database.

Updating Resources (PUT or PATCH)

The client can use PUT or PATCH to update an existing resource. PUT completely replaces the resource, while PATCH only modifies part of the resource.

Deleting Resources (DELETE)

This type of request is used to delete a resource. For example, removing a user from the database.

This post doesn't have any additions from the author yet.

18 Dec 08:25

What is DNS? What is DNS used for?

meme code
meme code@memecode
18 Dec 08:44

What is a domain (domain name)?

meme code
meme code@memecode
19 Dec 18:15

What are SSL and TLS? What is the difference?

meme code
meme code@memecode
19 Dec 18:17

What is the HTTP protocol? What is the difference between HTTP and HTTPS?

meme code
meme code@memecode
19 Dec 19:10

What is a "man-in-the-middle" attack?

meme code
meme code@memecode
20 Dec 17:33

What is an API? Can a web application use more than one API?

meme code
meme code@memecode
23 Dec 10:22

What is RESTful and how does it differ from REST?

meme code
meme code@memecode
23 Dec 10:34

What is the difference between PUT and PATCH?

meme code
meme code@memecode
23 Dec 11:29

What are cookies?

meme code
meme code@memecode
23 Dec 11:40

What is a session? (Web)

meme code
meme code@memecode
24 Dec 12:08

What is penetration testing?

meme code
meme code@memecode
24 Dec 12:08

What is SQL Injection?

meme code
meme code@memecode