8 Tweets Jan 31, 2023
What is CRUD?
Thread ๐Ÿงต๐Ÿ‘‡๐Ÿป
CRUD is an acronym for Create, Read, Update, Delete.
We're talking here about the database operation we're performing.
Let's say we want to manipulate data for the user's database table.
1๏ธโƒฃ Create
We'll call the create function when we want to create/add a new user to the database.
For this operation typically the HTTP POST method is used.
POST https://example .com/api/users/
Below you can see a sample JSON payload.
2๏ธโƒฃ Read
This operation is used to read data for a specific user.
For this operation GET HTTP method is used.
The sample path may look like this:
GET https://example .com/api/users/23 where 23 is the ID of the user.
Index (addition)
This is another Read operation we can perform.
We use this path when we want to retrieve data for more users at once.
GET https://example .com/api/users/
3๏ธโƒฃ Update
This operation is used to update data for a specific user.
For this operation PUT HTTP method is used.
PUT https://example .com/api/users/23
The payload looks the same as the one for CREATE action.
As you can see we changed the age and country of the user.
4๏ธโƒฃ Delete
This operation is used to delete a specific user.
For this operation DELETE HTTP method is used.
DELETE https://example .com/api/users/23
Hope you enjoyed this short tutorial.
If you found this thread useful, follow @Rapid_API ๐Ÿ™๐Ÿ’™

Loading suggestions...