Middle
Are you familiar with the CRUD model in REST API and which HTTP methods correspond to which operations?
sobes.tech AI
Answer from AI
The CRUD model (Create, Read, Update, Delete) describes four basic operations with data, which are often implemented in REST APIs using the corresponding HTTP methods:
- Create — creating a resource, usually corresponds to the POST method.
- Read — reading or retrieving a resource, corresponds to GET.
- Update — updating an existing resource, typically through PUT (full update) or PATCH (partial update).
- Delete — deleting a resource, corresponds to the DELETE method.
Example:
POST /users # Create a new user
GET /users/123 # Get data of user with ID 123
PUT /users/123 # Fully update user 123
PATCH /users/123 # Partially update user 123
DELETE /users/123 # Delete user 123