Sobes.tech
Junior — Middle

Is it possible to implement a RESTful API relying entirely on the DELETE HTTP method for all operations?

sobes.tech AI

Answer from AI

No, it is not advisable to rely solely on the HTTP DELETE method for all RESTful API operations. In REST architecture, each HTTP method has its purpose:

  • GET — retrieve data
  • POST — create a resource
  • PUT/PATCH — update a resource
  • DELETE — delete a resource

Using DELETE for all operations would violate the protocol semantics and cause confusion, making the API harder to support and understand.

An example of correct usage:

POST /users       # create a user
GET /users/123    # retrieve user with id 123
PUT /users/123    # update user
DELETE /users/123 # delete user