← homeProgramming (Програмування)

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

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 d...

Table of contentsClick link to navigate to the desired location
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.

🔥 More posts

All posts
Programming (Програмування)Dec 18, '23 08:25

What is DNS? What is DNS used for?

DNS, or Domain Name System, is a system that converts human-readable domain names (for example, t...

Programming (Програмування)Dec 18, '23 08:44

What is a domain (domain name)?

Domain (domain name) - is a readable textual logical identifier used to identify a resource on th...

Programming (Програмування)Dec 23, '23 11:29

What are cookies?

Cookies are data that websites store on a user's computer, phone, or other device (in the browser...

Programming (Програмування)Dec 23, '23 11:40

What is a session? (Web)

In the context of the web, the term session is usually used to describe the connection between a ...

Programming (Програмування)Dec 24, '23 12:08

What is penetration testing?

Penetration Testing (penetration testing), also known as security testing, ethical hacking, or pe...

Programming (Програмування)Dec 24, '23 12:08

What is SQL Injection?

SQL Injection (SQLI) is a type of attack on web applications, during which an attacker inserts SQ...