CRUD is an acronym for Create, Read, Update and Delete, the four fundamental operations of data storage.
REST is an acronym for REpresentational State Transfer, an architectural style used in Application Programming Interfaces, or API. REST was designed to standardize HTTP protocol communication between clients and servers.
Since REST and CRUD both describe manipulating data on a database, it's easy to think they are the same, but a closer look at both CRUD and REST will reveal some key differences.
CRUD is an acronym for Create, Read, Update, and Delete, the four fundamental operations of data storage. Computer scientists use CRUD as a measure of an application's completion state. If an application can't perform CRUD operations, it is incomplete.
CRUD requires that four fundamental operations can be performed by an application. They are:
A RESTful API is an acronym for Representational State Transfer. REST is an architectural style which defines a set of architectural constraints for stateless communication between Application Programming Interfaces, or APIs. It is not a standard, so it allows developers some flexibility, but it acts as a mediator between users, clients, and resources. REST has become ubiquitous in API programming because it emphasizes scalability and greater interoperability.
A REST API sends HTTP requests to endpoints, and receives JSON files in return. The most common requests (or HTTP verbs) are:
You can see how the GET, PUT, POST, and DELETE requests are roughly equivalent to CRUD, but let's use an example to examine their differences.
Let's say we're building a web business that sells shoes. When a customer visits our website, we want to provide up-to-date inventory information on shoes. This application must include CRUD to be considered complete, but will use the REST architectural style in negotiating HTTP methods, URIs (Universal Resource Identifiers), and database records.
What do those operations look like in CRUD and a RESTful architecture?
So, what's the difference?
REST refers to manipulating data through HTTP commands, and an ideology for how to streamline the relationship between the data that a user is manipulating on screen and the information that is saved on the server. A programmer can create a REST API that handles basic CRUD functions, but building a CRUD application in no way insinuates the use of RESTful programming.
CRUD describes an application's functions, not the relationship between web services, web applications, or APIs. In this way, CRUD is a relic of the monolithic era, when applications lived in one place, while APIs are better at describing client-server applications in the microservices era, where programs live across servers and clusters.
It's easy to confuse CRUD and REST operations because their operations are roughly analogous to each other, but if you remember that REST is a set of standards, and CRUD is a set of functions, you'll be on your way to a deeper understanding.