With diagrams: Commands, architecture and networking.
CRUD: The four basic functions of persistent storage; create, read, update, and delete
REST (REpresentational State Transfer): architectural style for providing standards between computer systems
REST is a defining set of principles for developing an API. Uses HTTP protocols like GET, PUT, POST and DELETE to link resources to actions within a client-server relationship. The principles of RESTful architectures serve to create an application as a lighter weight alternative to SOAP. APIs may be web-based or designed for specific platforms such as Android or iOS, and a
REST API makes it easy to implement other interfaces or applications over time which can turn an initial project from a single application into a platform.
The client may be a web browser requesting weather information in Washington i.e “washington” and receives a JSON string of [“16”].
REST API’s often use result codes (200 = OK; for example)
The six guiding constraints of REST
The client-server mandate
This shows there is a nature of separation between client and server. Services have multiple capabilities and listen for requests which are made by the consumer and accepted or rejected by the server.
Mandates the kinds of commands offered between the client and the server, which is initiated by the request. The request contains all the information necessary for the server to respond.
Server responses are either cacheable or not. A request can be cached by the consumer in an attempt to avoid re-submitting the same request twice.
Interface or uniform contract
RESTful architecture defines a Uniform Contract. This prohibits the use of multiple, self-contained interfaces within an API.
Layers are discrete, and multiple layers are used to grow and expand the interface.
CRUD is an acronym for CREATE, READ, UPDATE and DELETE. These form the standard database commands that are the foundation of
CRUD’s origins are in database records now
CRUD now has applications in the HTTP protocol, DDS and SQL.
CRUDcan be thought of as a cycle rather than an architectural system.
Mapping CRUD to HTTP
- POST: The client inserts or creates and object
- GET: The client wants to read an object
- PUT: The client wants to update an object
- DELETE: The client wants to delete an object
Which is, of course, a typical use of
This diagram is based on tables (the following example is from iOS, although thinking of table rows as cells should not be too tricky). Note the first letter from each bullet point:
- Create a new cell
- Read a cell
- Update a cell
- Delete a cell
The principles of CRUD
New records through INSERT statements.
READ the data based on input parameters. RETRIEVE procedures grab records based on input parameters.
UPDATE procedures modify records without overwriting them.
Delete procedures where specified.
Expanding CRUD: L
Sometimes CRUD is extended to CRUDL where the L stands for Listing. Listing helps with larger data sets that are not compatible with easy memory storage without resorting to pagination.
REST vs. CRUD
Similarities between REST and CRUD
REST is a robust API architecture and CRUD is a cycle for keeping records current and permanent.
CRUD can be mapped to DDS, SQL and HTTP protocols. The HTTP protocols are a link between resources in RESTful architecture which is a core piece of REST’s foundation.
Mapping CRUD principles to REST means understanding that GET, PUT, POST and CREATE, READ, UPDATE, DELETE have striking similarities because the former grouping applies the principles of the latter.
Difference between REST and CRUD
CRUD is a cycle meant for maintaining permanent records in a database setting
REST is an architectural system centred around resources and hypermedia, via HTTP protocols.
CRUD principles are mapped to REST commands to comply with the goals of RESTful architecture
Why do developers select REST?
Why do developers select CRUD?
These are the most basic functions of storage persistence, and are a good guide as to which features should be provided by your storage. It’s so common that people tend to implement CRUD without even thinking!
You’d be well advised to understand the difference between
CRUD (or even CRUDL) and
I hope this article has been useful in building your knowledge of these essential terms.
If you like it, why not hit me up on Twitter?
The Twitter contact:
Any questions? You can get in touch with me HERE