CRUD and REST

CRUD is an acronym that refers to the four basic operations related to data storage. Those four operations are Create, Read/Retrieve, Update, and Delete. Each word is self-explanatory:

— Create data and store it in the database
— Read or Retrieve data that’s stored in the database
— Update or change data that’s stored in the database
— Delete data that’s stored in the database

REST or RESTful is a set of guiding principles that create a stable, reliable, and predictable way to conduct data transfers over the internet. REST stands for REpresentational State Transfer. CRUD operations that conform to REST principles will map to RESTful HTTP verbs POST, GET, PUT/PATCH, and DELETE. CRUD operations map to the REST verbs in the following way:

— to Create data you have to POST it
— to Read or Retrieve data you have to GET it
— to Update data you have to PUT or PATCH it
— to Delete data you have to DELETE it

The four HTTP verbs are used to write seven different HTTP requests. GET is used to make 4 different requests and then the other three each make a single request. I’ll use songs in the following example.

— POST a newly created song in the database
— GET a list of all songs in the database
— GET a single song from the database
— GET a form to create a new song
— GET a form to edit an existing song
— PUT or PATCH existing song to change its data
— DELETE existing song from the database

Pairing the HTTP verbs with a path creates seven different requests. Whenever a specific song is targeted, it is retrieved from the database using its unique id.

Using RESTful routes simplifies CRUD operations in the development of applications. REST is a way to make data transfers over the internet and CRUD is a way to maintain data in a database. Mapping the two together in an application results in a great user experience.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Set up a Bitcoin-Core Full Node with a custom data directory

How To Use IEnumerator Coroutines In Unity!

The Fundamental of coding.

How To Prepare for FANG Interview?

Exploring Firebase Predictions

Record linkage in Pandas

Simulate Opening a URL in a New Tab

Learn From The Pros! DevOps Round-Up

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Wendy Raven McNair

Wendy Raven McNair

More from Medium

Highlights of UiPath 2021.10 & UiPath Platform Configuration Tool

MapMyRun to Strava Sync

Free simple database cloud storage with Repl.it

LIMIT and OFFSET Can Work with JOIN