Representational State Transfer (REST) is an architectural style for designing scalable web APIs. Though REST stands for Representational State Transfer, it is often used to refer to web APIs built using this style.
At its core, REST aims to create web services and APIs that leverage the features and capabilities native to the web itself. This includes using:
Key Principles of REST
There are several guiding principles and constraints that make an API "RESTful":
GET /users - gets a list of users
POST /users - creates a new user
By following these constraints, REST aims to create services that have good performance, scalability, simplicity, modifiability, visibility, portability and reliability.
REST in Practice
Here is an example of a RESTful API that manages customer data:
GET /customers - List all customers
GET /customers/123 - Get customer with ID 123
POST /customers - Create new customer
PUT /customers/123 - Update customer 123
DELETE /customers/123 - Delete customer 123
REST has gained immense popularity for building APIs that power web and mobile applications because of its simplicity and scalability. Major websites like Twitter, Youtube, Stripe, and Shopify all use RESTful APIs.
With the right foundations, REST makes it simpler to create services that can handle large amounts of traffic and data. The separation of client and server, stateless nature, and focus on caching help horizontally scale APIs.
Hopefully this gives you a better understanding of what REST APIs are, their core principles, and why they have been widely adopted!