Implementing REST API CRUD operations
Basically you should follow these principles:
Use the correct HTTP method
Use the correct HTTP status code
HTTP method
HTTP method | Operation |
POST | Create (or all NOT idempotent operations) |
GET | Read or Retrieve |
PUT | Update all fields of a resource (basically replace it) |
PATCH | Update only part of a resource |
DELETE | Delete |
HTTP response status
HTTP status code | Description | Example |
1xx | Informational | 100 Continue |
2xx | Success | 200 OK |
3xx | Redirection | 307 Temporary Redirect |
4xx | Client Error | 404 Not Found |
5xx | Server Error | 500 Internal Server Error |